Main Page‎ > ‎

macos survival guide

This page gathers what I did on my macbook air.

homebrew installation

Alternatively to port, you can install brew:

/bin/bash -c "$(curl -fsSL"
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> $HOME/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)

  • Here are the packages that I have installed:
brew install --cask google-chrome iterm2 google-backup-and-sync mailplane filebot joplin db-browser-for-sqlite
brew install irssi mosh openssh vim screen wget w3m gnupg the_silver_searcher htop coreutils mutt tig
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk8
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc

brew install openconnect
brew install sshuttle git-gui

brew install pass zsh-autosuggestions zsh-syntax-highlighting 
brew install romkatv/powerlevel10k/powerlevel10k
brew install pinentry-mac
brew install pass
pip3 install upass
brew install xdotool dmenu

#M1 does not support android ndk thus you need to apply and use emulator #preview

brew install --cask db-browser-for-sqlite

brew install mutt coreutils par tmux mosh lbdb rename irssi wget w3m gnupg a2ps
brew cask install osxfuse
brew install homebrew/x11/curlftpfs
brew reinstall coreutils --default-names
brew install homebrew/dupes/rsync bash procmail pstoedit curl urlview bash-completion ncdu htop hh colordiff 
brew install dos2unix git nmap perl psutils python renameutils gnu-sed
brew install tnef unrar bzip2 gzip p7zip
brew install ImageMagick par2 plotutils ps2eps tig wget libmtp pv netcat pigz apg aspell findutils par subversion 
brew install most ncmpcpp rsnapshot git
brew link ghostscript
# remove root folders in /usr/local/share...
brew install colordiff tig npm
npm install -g gitjk
brew install homebrew/science/octave
brew install homebrew/gui/meld
brew install homebrew/dupes/screen
brew install vim
brew install docbook docbook2x
export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
brew tap petere/sgml
brew install docbook docbook-dsssl docbook-sgml docbook-xsl openjade
brew install homebrew/science/transfig
brew unlink gnuplot; brew install gnuplot --with-x11
brew tap homebrew/science
brew update && brew upgrade
brew install gfortran
brew install octave
brew install fltk
brew install gnuplot
brew install xfig
brew install recode
brew install repo
brew install gpg
brew install python3 html2text pwgen mpv
brew install the_silver_searcher
brew install cunit
pip install pygame
  • zim installation:
brew install gtk-mac-integration
/usr/local/bin/pip install pyxdg
pip install --upgrade pip
tar zxf zim-0.65.tar.gz
cd zim-0.65“update-desktop-database”) in
/usr/local/bin/python ./ install
brew cask install --appdir="/Applications" --force macvim
brew cask install --appdir="/Applications" --force mactex
brew cask install --appdir="/Applications" --force cyberduck sigil texmaker calibre handbrake arduino iterm2 shiftit transmission-remote-gui gqrx vlc grandperspective gramps firefox
brew cask install --appdir="/Applications" --force google-chrome google-drive-file-stream
brew cask install osxfuse
brew cask install atom textwrangler
brew install homebrew/fuse/ext4fuse
brew install homebrew/fuse/ntfs-3g
brew install Caskroom/cask/google-photos-backup
brew install Caskroom/cask/google-drive
brew install Caskroom/cask/google-chrome
brew install Caskroom/cask/meld
brew install  Caskroom/cask/virtualbox Caskroom/cask/virtualbox-extension-pack
brew install docker Caskroom/cask/docker-toolbox
brew install Caskroom/cask/kindle-comic-converter Caskroom/cask/kindlegen Caskroom/cask/kindle
brew cask install the-unarchiver
brew cask install spotify
brew cask install android-platform-tools

  • update brew through
brew update
brew upgrade

Remove startup programes

  • find process with launchctl command
sudo launchctl list | grep -v apple
  • stop current session with launchctl remove label_of_program_to_remove
sudo launchctl remove com.fitbit.galileod
sudo launchctl remove com.leapmotion.leapd
  • erradicate it by removing instance in /Library/LaunchAgents/ or ~/Library/LaunchAgents/ folder
You can also add/remove startup actions in settings->users->startup menu.

Find processes preventing system to go to suspend

In order to find what is keeping your mac awake, use the following command:
pmset -g assertions | egrep '(PreventUserIdleSystemSleep|PreventUserIdleDisplaySleep)'

Timemachine tweaks

mdfind "com_apple_backup_excludeItem = ''"
tmutil addexclusion ~/Downloads/
tmutil addexclusion Calibre\ Library
tmutil addexclusion Applications/
tmutil addexclusion ./.Trash/
sudo defaults write /System/Library/LaunchDaemons/ StartInterval -int 604800
sudo defaults write /Library/Preferences/ MaxSize 204800

Mount ext4 ntfs partitions

After installing osxfuse ext4fuse and ntfs-3g you can use diskutil to identify partition number and:
diskutil list
sudo ext4fuse /dev/disk2s1 /mnt/ext4
sudo ntfs-3g /dev/disk2s1 /mnt/ntfs -olocal -oallow_other

Change hostname

sudo scutil --set ComputerName "imarc"
sudo scutil --set LocalHostName "imarc"
sudo scutil --set HostName "imarc"

Upload Maildir to gmail

git clone
brew install berkeley-db4
pip install bsddb3
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db@4/4.8.30 pip install bsddb3
  7     #import bsddb
  8     import bsddb3 as bsddb

Use it like this: -u -p mypasswordortoken -f tag maildirbox/cur

Android development

  • Install android studio and launch it
  • make some links
cd /opt
ln -s $HOME/Library/Android/sdk
cd /opt
ln -s android-ndk-r15 android-ndk
  • declare some shell variables
export JAVA_HOME="$(/usr/libexec/java_home)"
export ANDROID_HOME=/opt/android-sdk
export ANDROID_SDK=/opt/android-sdk
export ANDROID_NDK=/opt/android-ndk
export ANDROID_SDK_HOME=/opt/android-sdk
export ANDROID_NDK_HOME=/opt/android-ndk
  • configure android studio project to know about NDK dir location: File -> Project Structure -> Android NDK Location: /opt/android-ndk

Bluetooth keyboard and mouse connexion issues

Sigh it seems that I suffer too from this plague: some info here how to recover but nothing really working for me (yet).
Note that I did went through multiple PRAM SMS resets, full reinstalls of the OS without success. I checked also that bluetooth received signal strength was ok (RSSI -47dBm).
Only the magic keyboard and pad were connected and no Wi-Fi/BT perturbation was noticed around the iMAC.
Digging around I found that the macOS at wakeup was performing multiple resets of the controller perusing the kernel logs when I was experiencing disconnection issues:OS:
10:41:13.868184 +0200   kernel  **** [IOBluetoothHostControllerUSBTransport][SetRemoteWakeUp] -- deviceRequest() failed: 0xE00002D6 (kIOReturnTimeout)
10:41:13.868193 +0200   kernel  **** [IOBluetoothHostControllerUSBTransport][PrepareControllerForPowerOn] -- OFF -> ON  -- SetRemoteWakeUp(TRUE) returned error 0xE00002D6 (kIOReturnTimeout) -- this = 0xc000 ****
10:41:16.110215 +0200   kernel  **** [IOBluetoothHostControllerUSBTransport][DeviceRequestCompleteHandler] -- Received 0xE00002D6 (kIOReturnTimeout) -- 0xc000 ****
10:41:18.868326 +0200   kernel  [[0xE000]  OpCode 0xFC34 (Broadcom VSC -- Enable Radio) from: bluetoothd (104)  Synchronous  status: 0x00 (kIOReturnSuccess) state: 2 (BUSY) timeout: 5000] Bluetooth warning: An HCI Req timeout occurred.
 10:41:18.868368 +0200   kernel  **** [IOBluetoothHostController][IncrementHCICommandTimeOutCounter] -- increment command timed out counter -- 5 -- vID = 0x05ac pID = 0x8296 ****
10:41:18.868398 +0200   kernel  [BroadcomBluetoothHostController][PowerRadio] ### ERROR: opCode = 0xFC34 (Broadcom VSC -- Enable Radio) -- send request failed (err=0x10 (kIOReturnSuccess))
10:41:18.868412 +0200   kernel  REQUIRE_NO_ERR failure: 0x10 - file: /BuildRoot/Library/Caches/
10:41:18.868416 +0200   kernel  **** [IOBluetoothHostControllerUSBTransport][PrepareControllerForPowerOn] -- OFF -> ON -- mBluetoothController->CallPowerRadio() failed -- result = kBluetoothHCIErrorHostTimeout -- this = 0xc000 ****

Disappointed, I decided to switch back to wire usb connectivity for a long time before trying to migrate to an external BT dongle. 
I picked a kinivo BTD-400 bluetooth 4.0 (supporting BLE) adapter ( is claimed to be compatible with macOS (this is not a given...).
In order for bluetooth to switch to USB dongle by default use the following command:
sudo nvram bluetoothHostControllerSwitchBehavior=always
and switch back with
sudo nvram bluetoothHostControllerSwitchBehavior=never
Note that change is applied at next reboot.
In oder to undergo more advanced bluetooth debugging use bluetooth explorer program available in additional tools for xcode after registering for free as an apple developper via

So far I have not been exposed (as of yet) to BT disconnectivity hell.
What can I say: it is sad that Apple has not fixed or recognize this epidemic BT failure happening for their iMAC users.
For me, the "magic" keyboard and pad has lost its magic for sure... 

Fix meld launch

unlink /Applications/

Sync time manually via ntp

sudo sntp -sS