Showing posts with label Mac OSX. Show all posts
Showing posts with label Mac OSX. Show all posts

Thursday, August 3, 2023

Ansible "module_stderr": "env: python: No such file or directory\n"

Recently I got the following error while running existing Ansible playbook, which run successfully before :

fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "env: python: No such file or directory\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 127}


Ansible complains about python not found. I am using Homebrew python.

which python

python: aliased to python3

which python3

/opt/homebrew/bin/python3


stackoverflow option 2 works for me
https://stackoverflow.com/questions/3655306/ubuntu-usr-bin-env-python-no-such-file-or-directory

Just create symbolic link for python, required by Ansible:

ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python

Sunday, January 31, 2021

Heimdall on OS X High Sierra/ Mojave

Samsung Galaxy devices use Odin to flash firmware, however Odin is only available on Windows unfortunately.

Heimdall is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung Galaxy devices from Benjamin Dobell, an alternative for Odin on Linux/Mac.

Packaged Heimdall binary from link doesn't work on High Sierra or latter, so you will have to compile source code from gitlab. Heimdall frontend requires Xcode 9.4 above.

bfabiszewski @bfabiszewski has merge request: Fix build on macOS High Sierra for Heimdall, which replaces three CMakeLists.txt files from source. Without these fixes, cmake step from Benjamin Dobell will fail.

I followed fix from bfabiszewski on OS X  Mojave and built Heimdall binary successfully.

It seems that best practice is to run Heimdall with sudo, and also for heimdall front end. One caveat or feature I noticed is that Heimdall tends to release kernel drive after some operations, which might cause next task failed with initialization error. If this happen, just disconnect/reconnect usb cable, and run heimdall detect to make sure Heimdall can detect Samsung Galaxy devices.

Saturday, January 9, 2021

Setting up GDB for Debugging Python 3.9.1 on OS X Mojave

https://unconj.ca/blog/setting-up-gdb-for-debugging-python-on-os-x.html

brew install gdb and codesign gdb (updated procedure from: https://sourceware.org/gdb/wiki/PermissionsDarwin)

Brew installed python3 is already in thin format, no need to use lipo to extract, although you can still use lipo to check python executable format. (Non-fat file: python3 is architecture: x86_64)

Providing python3 interpreter (not symbolic link) with path if necessary, after gdb , and this will solve error message like: "0x7ffeefbff800s": not in executable format: file format not recognized

Had to compile Python3 from source to get rid of the following warning: ( ./configure --with-pydebug). Uncommenting SSL related lines in Modules/Setup file is to load ssl module in Python

Reading symbols from python...
(No debugging symbols found in python)

Also build gdb from source code again (./configure --with-python=/usr/local/bin/python3 --disable-werror), as brew info gdb failed with Brew installed python@3.9. Codesign command again for gdb.







Python gdp support: https://devguide.python.org/gdb/

 ~/.gdbinit with content below:

set startup-with-shell off

add-auto-load-safe-path /usr/local/bin


Monday, March 23, 2020

NFS share on OS X Sierra Version 10.12.6 (16G2128) MacBook Pro (15-inch, 2017)

https://support.apple.com/en-us/HT202243

Create NFS share on OS X for NFS client connection
  • mkdir <path to NFS share>
  • chown -R nobody:nobody <path to NFS share>
  • sudo nano /etc/exports, and add line:
<absolute path to NFS share> -maproot=nobody --alldirs ##allow client to mount at any point within NFS file system
  • sudo chmod 640 /etc/exports
  • nfsd status (if not running: nfsd enable && nfsd start)
  • showmount -e
Mount NFS share from OSX command line:
  • mkdir /mnt
  • sudo mount -o hard,nolock <NFS share path> /mnt
  • mount | grep nfs
  • ls /mnt

Thursday, February 22, 2018

Homebrew and Homebrew-Cask

Homebrew: The missing package manager for macOS
https://brew.sh/

Homebrew-Cask extends Homebrew and brings its elegance, simplicity, and speed to macOS applications and large binaries alike.
https://caskroom.github.io/

Monday, February 19, 2018

Early 2015 MacBook and late 2015 iMac 27'' 5K, target display mode alternative solution

Late 2015 iMac 27 5K doesn't support target display mode anymore, so early 2015 Macbook could not use it as display with target display mode.Plus This model MacBook doesn't come with thunderbolt port, one USB-c type only.

Obvious workaround will be old fashion remote desktop then. Apple's remote screen works, but it could not scale and the screen response depends network condition if it is via WiFi.

Then I got a Apple Thunderbolt 3 to Thunderbolt 2 adapter from BestBuy, however MacBook won't recognize it at all. Called Apple support couple times, and eventually they told me the usb type C port on this early 2015 MacBook is not really Thunderbolt 3, it is just USB 3.1 Gen one,  and 5Gbps is its maximum bandwidth, so the adapter won't work for it, and I could not use it for thunderbolt 2.0 conversion at all. (This is from Ajay Divakaran post on http://www.ajaydivakaran.com/imac-retina-and-target-display-mode/)

This leaves me to another try with USB 3.0 IP networking. after a good amount of google searching, I found one USB 3.0 cable with build-in switch: JUC500 from J5 Create. It is used for file transfer between two computer with USB 3.0 via smart Data Link protocol. (I did think about USB 3.0 cross over, but none of them available could be used for data transfer) I found the driver for IP over USB on OSX via HoRNDIS, which was build to share internet connection via USB cable for OS X, since Apple never provides its own driver for it. This driver was written some years ago, so it is for USB 2.0, and it is halfplex for some reason, so iPerf shows around 240Mbps throughput. I could not blame them at any rate. They was build to do they was meant to do, but not my case here. :-(

Eventually I went for ancient old cross over Ethernet cable with 1Gbps bandwidth, and of course I need a USB C to ethernet adapter for MacBook as well from eBay. This good old fashion connection was recognized by iMac ethernet port and Macbook USB type c port right away. With their own private subnet, 1Gbps connection via VNC connection (scaleable) could be an acceptable alternative for the missing target display mode finally.


App Store: macOS needs to repair your Library to run applications. Type your password to allow this.

Mac OS Sierra Version 10.12.6

New company Macbook Pro (15-inch, 2017) with VMware AirWatch and Enterprise Connect pre-installed after initial power on.

App Store crashed with error prompt: "macOS needs to repair your Library to run applications. Type your password to allow this. "

Quick google result to clean up files in ./Library and /Library about com.apple.appstore did not help, so I just look into error log: "You don’t have permission to save the file “Preferences” in the folder “Library”."

OK, it is about permission then,  so search it again and result from apple works:
 https://support.apple.com/en-us/HT203538

The procedure is to reset home folder permission, which could affect multiple applications, such as Preview, TextEdit, and even iTunes, not only App Store, but also Safari memory usage!

Wednesday, October 11, 2017

Malware MacDefender Removal experience

At least the following steps:
  1. Remove the malware browser plug-in (eg: OptiBuy), which will always try to get malware MacDefender/MacSecurity/MacProtector back.
  2. Stop MacDefender process via Activity Monitor, and then remove related programs from applications folder if any.
  3. System Preference ->Accounts->Login Items->remove MacDefender
  4. Remove OptiBuy from /Applications/;/Library/LaunchDaemons;/Library/Application Support; I also checked /System/Library/LaunchDaemons. When a user logs in, a per-user launchd is started, it loads list found in //System/Library/LaunchAgents, /Library/LaunchAgents, and the user's individual Library/LaunchAgents directory.
Based on timestamp, I also removed a suspected .ini file, though I am not sure it is related, however I don't believe Mac OS uses ini file anyway.

Sunday, October 30, 2016

iMac migration from Windows

I decided to use Migration Assistant from Mac OS X El Captain to transfer files from Windows machine to new iMac 27.

It is a decent tool, and it provides option to migrate email, but I did not try that. I just used it to transfer my files, music, and video, etc. Of course, client tools need to be installed on Windows machine. Copy process took few hours over Wi-Fi.

Then I noticed that OS X actually created  a new user account and copied all files I requested under that user! which is not exactly I wanted. I also observed by then, OS X createsits own Download, Pictures, Music, and movie folder outside Document folder, which is different from Windows by default. This is not quite convenient at all, and  later I realized that it is for iTunes and Photos, and iBooks default file path.

OS X denies to move my previous windows files to my current folder, since they belongs to the migrated user, so I used cp -r to make a copy of the files, and then chown -R. One thing I ignore during this process is to keep to original timestamp. I am not exactly sure they are already lost during Migration Assistant process, and my cp -r process, since I deleted the migration assistant user account later before I realize this.

Migration Assistant doesn't provide option for web browser bookmarks, so I export my IE bookmarks and Firefox book marks, and import them back to Safari/Firefox.

OS X uses unicode for text file encoding (UTF 8/16), which is different from Windows text file by default. In order to open previous windows file via TextEdit, you need change it preference. To change it permanently for other application, command-line iconv or duplicate an open file in TextEdit , and the select unicode encoding for saving file.

iTunes could not play APE/FLAC files, so alternate application is VOX. VOX might not recognize cue file properly, so you need a UTF  encoding version cue file via iconv or TextEdit.

iTunes can play MP3 files from my previous Windows machine, but I quickly noticed that MP3 tags are not displayed in iTunes Library. Again, it was due to encoding, as iTunes also use UTF, so a tag editor is required. eyeD3 is a command-line tool to do so, while Unicode Rewriter is a nicer application to do so too.

Before I changed MP3 file tag, I would like to know existing tag, Kid3 is the ideal application to do this.

I believe that Unicode Rewriter creates a new V2.3 MP3 tag with Unicode, after it reads original MP3 tag. Kid3 can be used to remove all unnecessary V1 tags and APE tags if any on MP3 files.

iTunes then can import unicode tagged MP3 file into iTune Library with proper display.

Audacity can modify sound file in various format

XLD can split APE files.

QuickPlayer might not be able to play certain video codec formats, so MPlayerX is the alternative to do so.


OS X creates default computer name during the first boot process, you can change afterward via command line scutil  or from System Preference->Sharing. OS X has three related names, one of them is used for file sharing over the network.

Samba file sharing for ubuntu client doesn't work well, but afp does.
Samba file sharing for Windows client need profiled credential.
Shared folder on OS X is defined in Sharing section of System Preference.

Unarchiver can extract RAR file format

Didbit 1: screen capture: CMD+SHIFT+3 or CMD+SHIFT+4  partial screen (from Apple support)
Tidbit 2: CMD + <- beginning of line; CMD + -> end of line; CMD+ up beginning of page; CMD + down, end of page
Tidbit 3: Option + <-, forward one word;Option+->, backward one word; up and down for paragraph movement.
Tidbit 4: to delete after cursor: Fn + delete
Tidbit 5: to zoom screen: enable it from System Preference -> Accessibility -> Zoom