Setting up my MacBook

Disable [rootless]

System Integrity Protection ("rootless") prevents some directories and files from being modified even by the root user.

Some programs do not work well with SIP enabled. Do the following to disable it:

  • Enter Recovery Mode: Start by pressing Command ⌘ + R
  • Open the terminal: Utilities » Terminal
  • Run the command csrutil disable
SIP is a security mechanism and should be re-enabled when possible.

Root Password:

sudo passwd


sudo scutil --set ComputerName "Air"
sudo scutil --set HostName "Air"
sudo scutil --set LocalHostName "Air"
sudo defaults write /Library/Preferences/SystemConfiguration/ NetBIOSName -string "Air"


Three-finger Drag

Accessibility » Mouse & Trackpad » Trackpad Options… » Enable dragging » three finger drag


Xsane, which I use on Linux, also works on Mac. It is open source and quite comprehensive:

brew install sane-backends
brew install xsane

Vuescan is a native app and works very well, but it is paid.


Accessibility » Zoom » Use scroll gesture with modifier keys to zoom: ^ Control


The latest version of XCode can be downloaded from the Apple Store or at, where beta versions are also available.

If the .xip file downloaded from the Apple website appears to be corrupted, try opening it with another program. Here, The Unarchiver showed “Data Corrupted,” but it worked perfectly with the Archive Utility.

Install the command line tools:

xcode-select --install
sudo xcode-select --switch /Applications/

Open XCode and accept the license agreement or type “agree” in sudo xcodebuild -license to agree.

Disable Gatekeeper to allow installing applications downloaded from the internet

Resolve the “XXX can’t be opened because it is from an unidentified developer”.

sudo spctl --master-disable

System Preferences > Security & Privacy > General » Allow apps downloaded from: Anywhere.

Re-enable with: sudo spctl --master-enable.


git clone --recursive

cd dotfiles

git submodule update --init --recursive


Download and install Homebrew:

ruby -e "$(curl -fsSL"

brew tap Homebrew/bundle

brew bundle --file=/Users/julio/dotfiles/Brewfile


Download Karabiner-Elements

Some advanced modifications can be found at

Swap Caps-Lock with ESC

The configuration is in the dotfiles.

Use Enter in Finder to enter a directory

Use F2 to rename

Zplug + Zprezto

Zplug manages ZSH plugins. It is installed automatically.

ln -s ~/dotfiles/.gitconfig ~
ln -s ~/dotfiles/.config ~
ln -s ~/dotfiles/.zsh ~
ln -s ~/dotfiles/.zshrc ~
sudo cp ~/dotfiles/fstab /etc/fstab

Zsh default shell

command -v zsh | sudo tee -a /etc/shells
sudo chsh -s "$(command -v zsh)" "${USER}"
compaudit | xargs chmod g-w

Zsh completions

Install the zsh_completions formula:

brew install zsh-completions

Add $(brew --prefix)/share/zsh-completions to $FPATH:

FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

Mounting HD

Create the indicated folder in /etc/fstab and mark it as unchangeable so that MacOS does not delete it after the disk is unmounted:

sudo mkdir /Volumes/Elements
sudo chflags uchg /Volumes/Elements/

Mount the disk:

diskutil mount disk2s1



Open Vim and download the plugins: :PluginInstall

Spell checker

Type :setlocal spell spelllang=pt_br in Vim and follow the instructions.


  • In Home (~)
    • View » Show View Options (Cmd+J):
      • Calculate all sizes,
      • Show Library Folder,
      • Show item info
  • On Desktop
    • Right-click » Show View Options (Cmd+J):
      • Show item info,
      • Increase Grid spacing

Prevent automatic sleep

There are several programs for this function:

  • InsomniaX
  • Caffeine
  • Amphetamine
  • KeepingYouAwake

I’m using KeepingYouAwake, which is very simple and free.

Through the command line, there is caffeinate:

Prevent sleep for 1 hour (3600 seconds):

caffeinate -u -t 3600

Prevent sleep until the command completes:

caffeinate -s command

Prevent sleep until Ctrl-C:

caffeinate -I

Prevent sleep when closing the lid

sudo pmset -a disablesleep 1

Disable HD sleep

System Preferences » Energy Saver: uncheck Put hard disks to sleep when possible

ln -s /Volumes ~/Desktop/

Disable guest user

System Preferences » Users & Groups: Uncheck “Allow guest to log in to this computer”.


Copy your backup keys and give the appropriate permissions:

cp -r /Volumes/Cofre/.ssh ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/*
chmod 644 ~/.ssh/*.pub


System Preferences » Spotlight

Spotlight returns quite useless things in search results. Disable Bookmarks & History, Fonts, Movies, Music, Other, Presentations, etc.

Uncheck “Allow Spotlight Suggestion in Look up”.



OSXFUSE and NTFS-3g can be installed for free via Homebrew.

Link mount_ntfs to ntfs-3g:

sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original
sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs

Paragon and Tuxera

I used NTFS-3g for many years (both on Linux and Mac), but its performance really leaves much to be desired.

I switched to Paragon when I needed to back up a few terabytes of data. The difference in transfer rate was quite significant.

Consider Paragon ($34.95) or Tuxera ($107.13) if you use NTFS-formatted disks.



$ export PYTHON_CONFIGURE_OPTS="--enable-framework --enable-unicode=ucs4 --enable-ipv6 --enable-loadable-sqlite-extensions"
$ pyenv install 2.7-dev
$ pyenv install 3.7-dev
$ pyenv rehash
$ pyenv global 2.7-dev 3.7-dev

The framework support (--enable-framework) is necessary for tools like YouCompleteMe.

Python libs

pip3 install flake8 ipython matplotlib numpy pep8 pep8-naming pygments scipy unidecode mako coursera awscli neovim


Ruby version manager (RVM)

curl -L | bash -s stable --rails


gem install pygmentize


Trackpad and Mouse

Natural scrolling

defaults write NSGlobalDomain -bool true

Tap to click

defaults write Clicking -bool true
defaults write NSGlobalDomain -int 1


defaults write TrackpadCornerSecondaryClick -int 0
defaults write TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain -int 0
defaults -currentHost write NSGlobalDomain -bool true


Enable tab in modal dialogs

defaults write NSGlobalDomain AppleKeyboardUIMode -int 3


defaults write NSGlobalDomain AppleLanguages -array "en" "de" "pt-BR"

defaults write NSGlobalDomain AppleLocale -string "pt_BR@currency=BRL"

defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"

defaults write NSGlobalDomain AppleMetricUnits -bool true

Enable Debug menu in App Store

defaults write ShowDebugMenu -bool true

Folder where screenshots will be saved

SCREENSHOTS="${HOME}/Desktop/Screenshots" && mkdir "${SCREENSHOTS}" && defaults write location -string "${SCREENSHOTS}"

Enable key repeat when holding down a key (requires restart)

    $ defaults write -g ApplePressAndHoldEnabled -bool false

Faster key repeat rate

    $ defaults write NSGlobalDomain KeyRepeat -int 2

Open Finder at home (~/)

    $ defaults write NewWindowTarget -string "PfLo"
    $ defaults write NewWindowTargetPath -string "file://${HOME}"

Show path bar in Finder

    $ defaults write ShowPathbar -bool true

Show status bar in Finder

    $ defaults write ShowStatusBar -bool true

Does not warn about extension change

    $ defaults write FXEnableExtensionChangeWarning -bool false

Checks for updates daily (default: one week)

    $ defaults write ScheduleFrequency -int 1

Displays internal HDs icon on the desktop

    $ defaults write ShowHardDrivesOnDesktop -bool true

Displays external HDs icon on the desktop

    $ defaults write ShowExternalHardDrivesOnDesktop -bool true

Displays removable media icon on the desktop

    $ defaults write ShowRemovableMediaOnDesktop -bool true

Displays servers icon on the desktop

    $ defaults write ShowMountedServersOnDesktop -bool true

Does not create .DS_Store on network volumes

    $ defaults write DSDontWriteNetworkStores -bool true

Activates the development menu and Web Inspector in Safari

    defaults write IncludeInternalDebugMenu -bool true && \
    defaults write IncludeDevelopMenu -bool true && \
    defaults write WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \
    defaults write -bool true && \
    defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

Shows absolute path in Finder title bar

    $ defaults write _FXShowPosixPathInTitle -bool YES

Displays ~/Library

    $ chflags nohidden ~/Library

Default Apps


    $ vim ~/Library/Preferences/


    $ duti -s org.videolan.vlc .mp4 all

Activates CUPS web interface

    $ sudo cupsctl WebInterface=yes

The server will be available at http://localhost:631/admin.

Lock screen

System Preferences » Security & Privacy » General » Require Password » 5 seconds

Lock: Control + Shift + Power Sleep: Command ⌘ + Option ⌥ + Power

Shortcut: System Preferences » Keyboard » Shortcuts » + » Lock Screen » Shortcut


Terminal colorscheme

Apply Zenburn

$ wget

Command ⌘ + i » Colors » Color Presets » Import… » Zenburn.itermcolors » Open General » Copy Current Settings to Selected Profile.


The Nerd Fonts package was installed via Homebrew. To use it in iTerm2, follow these steps:

Preferences » Profiles » Text » Non-ASCII Font » Hack Regular Nerd Font Complete

Login Items

System Preferences » Users & Groups » Current User » Login Items

Keep only:

  • Flux
  • InsomniaX (or equivalent)
  • SwitchResX Daemon
  • Moom

Chrome as default browser

xdg-mime default chromium.desktop x-scheme-handler/http
xdg-mime default chromium.desktop x-scheme-handler/https

Mute Chrome

In the address bar: chrome://flags/#enable-tab-audio-muting


I have a script that downloads the hosts file from and installs it automatically:

sudo ~/dotfiles/

An application that helps manage the hosts file is GasMask:

brew cask install gas-mask


Keep only useful programs in the Dock:

  • Finder
  • Mail
  • Contacts
  • Calendar
  • iTerm
  • Google Chrome


In addition to logging into Spotify, you also need to set up scrobbling to Preferences » Connect to

Preferences: Disable “Local Files”


Avoid separate cover in Two Page view in Preview

Whenever you display a PDF with two pages per view, Preview will show the first page separately as if it were the cover of a book. Sometimes this is not what we want and there is no way to disable this “feature”, but there is a trick: insert a blank page and move it as the first page: Edit » Insert » Blank Page; View » Contact Sheet drag the blank page to the first position.

Scroll in terminal

Shift+fn+UP and Shift+fn+DOWN


Setting up Gmail emails is straightforward, but besides them, I also use an email from my own host.

If Mail does not automatically recognize the function of each imap folder, it will need to be defined manually. Ex.:

Select Deleted Messages » Mailbox » Use This Mailbox As » Trash Mailbox


Check if the order of directories in /etc/paths is correct and all directories are present.

Programs installed without Homebrew

  • Adobe Acrobat Pro or PDF Expert: PDF viewing and editing
  • Adobe Lightroom: Organize photo gallery
  • Adobe Photoshop: Image editing
  • CleanMyMac: System maintenance
  • Dash: API Documentation Browser
  • iStat Menu: Menu bar with CPU/Memory/Network/etc status
  • LittleSnitch: Blocks unwanted connections. Free alternative: Lulu
  • MacPaw Gemini: Removes duplicate files
  • Microsoft Office
  • Many Tricks Moom: Window management
  • Parallels: Virtualization
  • SideSync: Manage Samsung devices
  • SwitchResX: Screen resolution
  • Vuescan: scanner (free alternative: xsane)
  • Wunderlist


OS X comes with pfctl. LittleSnitch and Lulu also allow managing outbound connections.

SSL Certificates

In my case, I have to add the certificates from the university:



brew install mysql
mysql.server start
mysql_upgrade -u root -p
mysql.server restart
$ mysql -u root -p
  mysql> select host, user, password from mysql.user;
  mysql> CREATE USER 'julio'@'localhost' IDENTIFIED BY '123456';
  mysql> GRANT ALL PRIVILEGES ON *.* TO 'julio'@'localhost' WITH GRANT OPTION;
  mysql> show variables;
  mysql> show databases;
  mysql> use nome_do_esquema;
$ mysql.server stop

MySQL Workbench

brew cask install mysqlworkbench


Uncomment the following lines in /etc/apache2/httpd.conf:

LoadModule authz_core_module libexec/apache2/
LoadModule authz_host_module libexec/apache2/
LoadModule rewrite_module libexec/apache2/
LoadModule cgi_module libexec/apache2/
User folder

Uncomment the following lines in /etc/apache2/httpd.conf:

LoadModule userdir_module libexec/apache2/
Include /private/etc/apache2/extra/httpd-userdir.conf

Uncomment the following line in /etc/apache2/extra/httpd-userdir.conf:

Include /private/etc/apache2/users/*.conf

Create the file /etc/apache2/users/julio.conf:

<Directory "/Users/julio/Sites/">
    Options Indexes MultiViews FollowSymLinks
    Require all granted
    AllowOverride All
    Order allow,deny
    Allow from all

Restart Apache with sudo apachectl restart.

Create the ~/Sites folder:

mkdir ~/Sites


sudo cp /etc/php.ini.default /etc/php.ini
sudo -e /etc/php.ini


sudo vim /etc/apache2/httpd.conf
Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    <IfModule mod_authz_core.c>
        Require all granted
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Allow from all

Google KSFetch

Google checks for updates every hour. Change this to 7 days:

defaults write checkInterval 604800

Or disable the check completely:

defaults write checkInterval 0

iTerm2 + tmux

iTerm2 is integrated with tmux, a terminal multiplexer.

Install via homebrew:

brew install tmux

Control mode:

tmux -CC


Better than screen and tmux

Update: also consider Zellij.


Date & Time:

  • Use a 24-hour clock,
  • Show the day of the week,
  • Show date


Every time you open an .epub, iBooks copies it to the directory /Users/julio/Library/Containers/

The original is kept where it was. It may be useful to delete the files (through iBooks itself) to save space.

Inline attachment viewing type:

defaults write DisableInlineAttachmentViewing -bool yes
defaults write DisableInlineAttachmentViewing -bool false


git config --global credential.helper osxkeychain

This is already configured in ~/.gitconfig.


Download from

iStat Menus

Settings » Date & Time:

  • Uncheck Show date and time in menu bar.

Settings » Energy Saver:

  • Uncheck Show battery status in menu bar.

Rearrange menu items by dragging them while holding the Command (⌘) key.


Skype » Preferences… » Save files in: ~/Downloads/Skype


Telegram » Preferences… » Advanced Settings » Save documents to: ~/Download/Telegram

Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus