Skip to content

Instantly share code, notes, and snippets.

@tsykoduk
Last active September 7, 2016 14:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsykoduk/b5d61aa7850f220596f2 to your computer and use it in GitHub Desktop.
Save tsykoduk/b5d61aa7850f220596f2 to your computer and use it in GitHub Desktop.

###Mac OSX Development/Admin Tools

0 - XCode

XCode, or at least the XCode command line extensions, are at the core of any development work that you are going to do on a Mac. You'll need to install it to get things like the C Complier and bootstrap the build environment. If you are going to be doing iOS or Mac OSX development, get the entire package from the App Store. If you are not, just install Homebrew, and it will prompt you to install the XCode CLI tools.

1 - Homebrew

OSX Unix Package Manager. The site is at brew.sh. You can use this to install things like Git, Ruby, Python, etc.

For example, I have the following packages installed on my Mac:

~ ☯ brew list
apple-gcc42  dos2unix	 gdbm	      go	       leptonica	 libtool      ncurses	  postgresql  tig		          wxmac
autoconf     elixir	     gettext      imagemagick  libffi	     libxml2      node	      python      tree		          xmlstarlet
automake     erlang	     ghostscript  jbig2dec	   libgpg-error  libxslt      openssl	  readline    typesafe-activator  xz
bash	     erlang-r16  git	      jmeter	   libksba	     libyaml      ossp-uuid   ruby	      unixodbc
coreutils    fortune	 git-extras   jpeg	       libpng	     little-cms2  pgcli	      sqlite      watch
cowsay	     freetype	 gmp	      keybase	   libtiff	     mysql	      pkg-config  tesseract   wget

Note, that I replaced the bash shell on my mac with a more modern version, you don't need to do that ;-). Also I have a lot of Unixy command line stuff that I am used to having (tig, tree, wget, coreutils). If you are going to go down this path, I'd only install the stuff that you actually need. The nice thing is if you hit a wall and there is a CLI tool to fix it, it's a quick brew install away.

One tool that I will call out is dos2unix - it allows you to convert Windows formatted text files to Unix formatted (for more on this read this article). Normally you will not need to do this, but if you are trying to open a text file on your mac in Vi, Emacs or Nano and it's formatted weird, you can use that tool.

Some of the useful commands with Homebrew:

  • brew help - help on brew

2 - IDE or Programmers text editor

This is a very personal choice, and a lot depends on what you are coding. Some good choices are Vim, Emacs, Atom, Visual Studio, Sublime, or my favorite: Textmate 2. I've used textmate for going on 10 years now, so don't take my endorsement as anything other then I hate change.

3 - Windows RDP client

As I am sure you are aware, this will allow you to remote into Windows boxes and admin them in the windows way. Sadly, I think the best free option is the Microsoft tool. It really does not have a lot of bells and whistles. I used to use Cord back in the day, however it's crashy under a modern OSX

4 - Vagrant and Virtual Box

I use Vagrant a lot to manage Windows and Linux virtual machines running under Virtual Box. This can be super useful to run a domain member machine on your Mac, and access the tools that you are used to locally. It's also good for setting up development environments in a repeatable fashion (For example, see this as an example of a Vagrant file that completely sets up a Rails development environment.)

5 - Shell Scripting

The shell is the Powershell of the Unix world. The real difference is that it's been around since the early 70's in one incarnation or another. As you can imagine it's evolved into a very powerful tool. In fact the shell is a complete programming langage. For example, here is a host monitoring system that I wrote in bash years ago. Not mentioned in the code is the enhancements that I added to ping and leverage the Tivoli endpoints for the 400+ machines that we were monitoring. We used it to insure that Tivoli was running on the machine, and restart it if it had failed. We also used it to fire jobs on the endpoints. As you can see you can use the shell to do just about anything.

Learning how to do basic scripting in a shell will make your life a lot easier. I normally recommend Learn the Command Line the Hard Way by Zed Shaw. The online version is free, and very useful. I highly recommend working through the book.

You can find your Mac's shell in terminal.app. It's super customizable, so you can do things like set the background colors, text colors etc.

You can also edit your .bash_profile and .bashrc to control how Bash works. For example:

~ ☯ cat .bash_profile 
export PS1="\w ☯ "

export CLICOLOR=1
export LSCOLORS=dxfxcxdxbxegedabagacad

#For GNU utils
alias ls="ls --color"

### Added for Homebrew
PATH=/usr/local/bin:$PATH
### Added to install the GNU toolset
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
### Added for rubygems + homebrew support
export PATH=$(brew --prefix ruby)/bin:$PATH
### Added for Python under Homebrew
#PATH=/usr/local/share/python:$PATH
### For gems
export PATH=/usr/local/Cellar/ruby/1.9.3-p194/bin:$PATH

source .bashrc

fortune -s | cowthink | lolcat

The first thing there is the cat command. That just displays a file. The second thing is the export PS1="\w ☯ ". That changes my CLI prompt from the default to something more interesting. You can do a lot of customization there!

A few of the tools that I use all of the time:

  • wget Super easy way to GET stuff. You need to install this using brew install wget.
  • curl Harder way to get stuff, but it supports more HTML commands then just GET, and you can use it to do stuff like send payloads. This comes with OSX.
  • ls List the contents of a directory
  • grep Search for strings in files, directories or streams.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment