Main Page‎ > ‎

macos survival guide

This page gathers what I did on my macbook air.

port installation 

In order to survive on MacOS I installed port packaging system to be able to get all my favorites opensource tools following these instructions.

Here are the packages that I have installed:
port install mutt-devel +compress +gdbm +gnuregex +gpgme +headercache +imap +pop +sasl +sidebar +smtp +ssl +trash
port install tmux mosh screen lbdb rename irssi lftp wget w3m gnupg vim a2ps transfig xfig rsync bash coreutils procmail pstoedit curl urlview  dos2unix git muttprint nmap perl5 psutils python27 renameutils recode tnef2txt tnef unrar zim bzip2 gzip ImageMagick par2 plotutils ps2eps tig wget mtpfs libmtp p5-file-rename pv netcat pigz apg aspell file findutils par subversion texlive-science texlive-latex-extra texlive-latex-recommended texlive-lang-french most ncmpcpp rsnapshot gmake libsdl git gnupg
#NOT WORKING docbook-sgml-4.2 docbook-utils
sudo port install octave +atlas+doc+gcc47
port install py27-pip
port select --list pip
port select --set pip pip27
port select --list python
port select --set python python27
pip install google-api-python-client

To upgrade packages:
sudo port selfupdate
sudo port upgrade outdated
if fails port -p upgrade outdated

Reclaim some disk space from port:

sudo port clean --all all
sudo port uninstall inactive

homebrew installation

Alternatively to port, you can install brew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Here are the packages that I have installed:
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
PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH
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
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
brew install tnef unrar bzip2 gzip p7zip
brew install ImageMagick par2 plotutils ps2eps tig wget libmtp pv netcat pigz apg aspell findutils par subversion 
PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"
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
wget http://zim-wiki.org/downloads/zim-0.65.tar.gz
tar zxf zim-0.65.tar.gz
cd zim-0.65
#subprocess.call(“update-desktop-database”) in setup.py
/usr/local/bin/python ./setup.py install
brew cask install --appdir="/Applications" --force macvim
brew cask install --appdir="/Applications" --force mactex
PATH=/Library/TeX/texbin:$PATH
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
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

  • 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 = 'com.apple.backupd'"
tmutil addexclusion ~/Downloads/
tmutil addexclusion Calibre\ Library
tmutil addexclusion Applications/
tmutil addexclusion ./.Trash/
sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 604800
sudo defaults write /Library/Preferences/com.apple.TimeMachine 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 https://github.com/andreasscherbaum/maildir2gmail
brew install berkeley-db4
pip install bsddb3
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db@4/4.8.30 pip install bsddb3
vi 
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py
  7     #import bsddb
  8     import bsddb3 as bsddb

Use it like this: maildir2gmail.py -u myname@gmail.com -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
unzip android-ndk.zip
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
END

Comments