Basic OS X configuration to code interfaces

First of all, this is a great list of things to do:

https://www.davidculley.com/setting-up-a-new-mac/

node.js

After install, type:

node -v && npm -v

Git

You need for almost everything.

Check if installed:

git --version

Then, access Git configuration file and update your name and email:

git config --global --edit

You can configure aliases shortcuts to your bash terminal commands, like this:

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.ps push
git config --global alias.pl pull
git config --global alias.last 'log -1 HEAD'

SSH Keys

To clone a project from GitHub, for example, you need a public/private rsa key pair. To generate these keys, type in your Terminal:

ssh-keygen

Answer the questions and at the end you are going to have a a pair of keys into folder ~/.ssh . The id_rsa file is your private key. The id_rsa.pubfile is your public key.

Now, if you need to give someone access, for instance, clone GitHub repositories, you should copy your public key. It starts with ssh-rsa and you can view it typing:

cat ~/.ssh/id_rsa.pub

GitHub

To git clone a repository from your GitHub account into your desktop, access https://github.com/settings/keys, add a Title and your copied public key.

At your terminal, to git clone a GitHub repository, type:

git clone git@github.com:username/repository-name.git

Homebrew

Installing software is a pain in the ass, but this can be done much easier using a tool called Homebrew. All you need to do is to open Terminal.app and copy/paste the following line of code into the terminal window:

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

Z Shell

https://www.davidculley.com/customizing-the-terminal/

Agnoster Theme

Homebrew stuffs

brew cask install slack
brew cask install imageoptim
brew cask install sublime-text
brew cask install visual-studio-code
brew cask install dash
brew cask install firefox
brew cask install google-drive
brew cask install docker

rbenv

For compile SASS, for example, you will need Ruby installed, and the best way to manager Ruby versions is rbenv. To install it:

$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ ~/.rbenv/bin/rbenv init

Open a new tab in your terminal to restart Path. Then check if rbenv was installed:

$ type rbenv
#=> "rbenv is a function"

After all, install ruby-build as a plugin to enable rbenv install command.

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ ~/.rbenv/plugins/ruby-build
$ echo ‘export PATH=”$HOME/.rbenv/plugins/ruby-build/bin:$PATH”’ >> ~/.bashrc
$ source ~/.bashrc

Now, you can list all Ruby version and install your chosen one:

# list all available versions:
$ rbenv install -l
# install a Ruby version:
$ rbenv install 2.4.1
If you are facing problems whichever task, try to update your system running:
$ sudo dnf install

Choose your global version now:

$ rbenv global 2.3.0

Check it version out:

$ ruby -v

Create your ~/.gemrc:

$ echo "gem: --no-document" > ~/.gemrc

Now you can start installing your gems. To list all your gems:

$ gem list

Bundler

This Ruby gem is very useful. You will need it someday, sometime. Install it by:

$ gem install bundler

SASS

To compile your SASS files into CSS files from command line, install SASS gem and check it version after:

$ gem install sass
$ sass -v
# Sass 3.4.23

Bower

Just:

$ npm install -g bower

Yarn

A newer option to NPM packages suitable for Webpack users. After installing Node with NPM, you can just:

sudo npm install -g yarn

To upgrade to latest version:

sudo npm upgrade -g yarn

Maven

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

First check if Java is installed:

$ java -version
$ which java

Set up $JAVA_HOME variable, checking where JVMs are:

$ usr/libexec/java_home -V
$ vim .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
$ source .bash_profile

Install Maven with Homebrew:

$ brew install maven

Your install path must be something like this:

/usr/local/Cellar/maven/3.5.0

Or with:

$ which mvn
/usr/local/bin/mvn

Apache, PHP, MySQL

$ brew tap homebrew/apache
$ brew tap homebrew/completions
$ brew tap homebrew/php

Enable auto-completion:

$ brew install bash-completion

Add auto-completion to bash:

[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

Apache

$ brew install httpd24 --with-privileged-ports --with-http2

So let’s check this has worked by typing:

$ which apachectl
/usr/local/bin/apachectl

Disable OSX’s built-in Apache server:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

This allowed Apache to start on 80.

Now starts Apache:

$ sudo apachectl start

Now open your web browser and go to http://127.0.0.1, you should see a message saying “It works!”

You should now set Apache to launch on startup.

$ sudo brew services start homebrew/apache/httpd24
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.