Switching node versions with Homebrew


Just a quick trick to switch between node versions when you install more than one version through Homebrew (brew install node)

You check the currently selected version with node --version. Working out version from paths in brew list node or looking for an asterisk next to a version listed in brew info node can also be used if you're after a different package.

1) List the versions present on your system: brew list --versions node

2) Switch to one of the versions, in my case I'm switching to 6.2.2: brew switch node 6.2.2

That's it, you can verify the operation was successful with node --version.

Tags: brew, homebrew, node, versions

Installing databases as services with Homebrew on a Mac


First steps

Update your homebrew references and install services package to run the servers in the background.

brew update
brew tap homebrew/services

Installing services

Now you can install MongoDB, Redis or MySQL. Install whatever you need depending on your setup.

brew install mongodb
brew install redis
brew install mysql

Starting services

You can then control services with syntax typically seen in service launchers.

brew services start [service]
brew services stop [service]
brew services restart [service]

Replace [service] bit with mongodb, redis, mysql or whatever service you need to run and you're done.

Some debug options

brew services list
brew services cleanup

Tags: mac, homebrew, mongo, redis, mysql, services