Bought a new Macbook

It’s almost about 4 years ago where I’ve bought my first Mac (Macbook Air mid 2013 13″ Intel I7 CPU”)
The decision wasn’t easy for me while using Windows for at least 20 years.
I know the OS pretty well so fixing things which might went terrible wrong is a no brainer not to mention the high price for a Mac no matter which Model, was also a factor which I’ve had to consider.

Well, the reason that I’ve bought one nevertheless was when I’ve saw how nicely everything play’d together while diving into web development. Sure today most of the stuff can be done with a Windows OS too but after all the time working with a Mac I’ve never looked back.

Don’t get me wrong I’m definitely not one of those “Apple Fanboys” which always came with there standard arguments: “Windows Machines” always crash or have to fight with a lot of other threads. Thats simply not true, if you know your OS you know what to do, most of the time the problem sits directly in front of the PC and thats a fact.

I’ve had my Windows 7 machine up and running for years with no crashes or any virus threads I’d had to fight with but to be honest as Windows 8 or Windows 10 came out I’ve found my self being not so productive anymore as I was on earlier Windows versions. Most of the time I’ve find myself searching around for simply tasks, which I’ve found before using Windows 7 in seconds. I’ll think Microsoft did a bad job with the new OS even with the missing start menu which came back in Windows 10, anyway the OS didn’t feel right for me anymore.

What I really hate today using Windows (in a VM on my Mac) is, the what I’d like to call update horror. I’m not able to boot up my VM without waiting at least several minutes to let Windows install tons of updates, here really Apple did a better job for me in my opinion.

Well but Apple is not the holy grail too I mean seriously a computer which costs more then 2.300€ and no USB Ports nor do I’ll have a card reader or a simple RJ45 interface can’t change my SSD if broken, can’t upgrade my RAM with an accu glued? I’d call it an effrontery. Sure all can be bought if needed but hey seriously?Thats like buying a new car with only the motor inside, if you want to drive around just buy the rest.

Anyway so my Macbook Pro 2017 15″ Retina with Touch Bar had arrived and I’d have a lot configuration stuff to do, so the following is basically a reminder to myself how I’ve configure my new machine.

Clean the Mac

While I’m pretty sure I’ll never use it I’ve simple deleted GarageBand, Pages, IMovie, Keynote and Numbers from my system. Well, for Garageband I’ll also had to delete the following:

  • Macintosh HD/Applications/GarageBand.app (1.16GB)
  • Macintosh HD/Library/Application Support/GarageBand (995MB)
  • Macintosh HD/Library/Application Support/Logic (880MB)
  • Macintosh HD/Library/Audio/Apple Loops (up to 10GB)*

Note that the size of the Apple Loops directory will vary depending on the number and type of loops downloaded by the user. You should not delete this folder (or the Logic folder) if you are using Logic Pro.

Standard Apps

The apps which I’ll definitely use are:

  • Alfred
  • TotalFinder
  • LittleSnitch
  • Sublime Text
  • Dropbox
  • Nodejs
  • Composer
  • Gulp

For the second App to work correctly you have to disable SIP (System Integrity Protection.) This can be easily done while booting your machine into recovery mode (re-boot while holding down Command + R) until the Apple logo appears.

Click Utilities > Terminal

Type the following command at the prompt:

crsutil status (to get the current status of SIP)
csrutil disable; reboot (to disable SIP and reboot the machine)

follow the on screen instruction of TotalFinder

csrutil enable; reboot (to re-enable SIP and reboot the machine)

You can verify if a file or folder is restricted by issuing this LS command using the capital O (and not zero 0) to modify the long listing flag:

Terminal command

ls -lO /System /usr

Look for the restricted text to indicate where SIP is enforced.

By default (=SIP enabled), the following folders are restricted

/System
/usr
/bin
/sbin
Apps that are pre-installed with OS X

The following folders are unprotected:

/Applications
/Library
/usr/local

Package Manager

Just for making the life easier I’ll install Homebrew.

Terminal command

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Shell

I’m not a friend of the default Shell I’m using ZSH or more specific “Oh-My-ZSH”

Terminal command

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

or if you prefer using wget

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Oh-My-Zsh is using ~/.zshrc instead of ~/.bashrc or ~/.bashprofile for configuration.

Well Sublime Text can be started from the command line using “Subl” and while I’d like it to be my default Editor I’ve need to make it work on Apple’s High Sierra OS in order to edit my ~/.zshrc later.

So again fire up the terminal:

Terminal command

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

if everything works correctly we can edit ~/.zshrc with the following command

Terminal command

subl ~/.zshrc

this should open the Oh-My-Zsh configuration file in Sublime Text.

Note: To use Sublime Text as the editor for many commands that prompt for input, set your EDITOR environment variable:

export EDITOR='subl -w'

Install Composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Terminal command

brew update (update any brew installed package)
brew doctor (show if we’ve any problems)
brew install composer (install composer)

Installing GIT

By far, the most widely used modern version control system.

Terminal command

brew update
brew install git

Oh-My-ZSH Config

As mentioned earlier let’s configure OH-My-ZSH now.

Terminal command

Subl ~/.zshrc

Adjustments to my path:

export PATH=$HOME/bin:/usr/local/bin:~/.composer/vendor/bin:$PATH

The theme I’ll use:

ZSH_THEME="agnoster"

Preferred editor for remote and local connections:

if [[ -n $SSH_CONNECTION ]]; then
  export EDITOR='subl -w'
 else
  export EDITOR='subl -w'
 fi

Specifying -w will cause the subl command to not exit until the file is closed.

Aliases I’ll use:

E.g.Composer

alias composer="php /usr/local/bin/composer.phar"

And for Git:

alias ga='git add .'
alias gs='git status'
alias gpo='git push --set-upstream origin master'
alias gc='git checkout'
alias gpu='git pull'                     

Now you might wonder where I’ll use Git commit I’ll show it later there’s a special treatment for it.

Oh-My-ZSH Theme

As mentioned in my ZSH configuration I’m using the theme ‘agnoster’ which needs a little configuration too. Install the Powerline Font

Install the Ubuntu Mono derivative Powerline Font to your Fonts directory.
In the Terminal configuration adjust the Font to your liking take a look at mine in the screenshot below.

TermConf

For the color scheme of my terminal window I’ll use the Dracula theme.
So now my terminal looks like this (notice the git stuff)

Terminal

Install NodeJs

Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world.

Terminal command

brew update
brew doctor
export PATH="/usr/local/bin:$PATH" (Homebrew’s location to $PATH in .zshrc file.)
brew install node (Install Nodejs)

After I’ve installed Nodejs and gave npm a try issuing npm -v in the terminal I’ll noticed an update for Npm is available)

I simply followed the instructions and executed:

Terminal command

npm i -g npm

to get the newest version installed.

Installing Gulp

Gulp is an easier and slightly more modern javascript task runner than its sibling Grunt, which helps you automate numerous tasks in your workflow. You need to install Gulp both globally and locally in your project.

So to install Gulp globally:

Terminal command

sudo npm install gulp-cli -g

Special treatment Git Commit

As mentioned earlier, I’ll handle this command differently because of a parameter I’ll add, my system is also configured to use PGP for commits so that every commit I’ll do has my PGP signature automatically added, so that Github e.g. can verify it.

So my commit command normally looks like this with a message added:

git commit -am "My commit message"

You might know aliases do not not support additional parameters but there is a workaround simple use anonymous functions.

So from my .zshrc I’ll use the following:

alias gcam='f(){ git commit -am $1; unset -f f; }; f'

which is pretty cool now I can execute git commit -am "Text" like this:

gcam "Blubb"

To be continued…