This post is about running install scripts saved in Gists on Github locally from a Mac Terminal using curl. However, this should work for just about any script saved online and is not in any way limited to gists.

You need to have Command Line Tools for Xocde installed.

Run a script off a Github Gist

First things first, find a script that you want to install. Here is a bash script that i wrote for installing WordPress.

Get the raw version of it and copy the link. Now we are going to curl that link to get the content in the file and then pass that content to bash.

curl -L | bash

The -L flag is for location. If the server reports that the requested page has moved to a different location, this option will make curl redo the request on the new place.

The pipe | links the two commands so that the output of the curl command becomes the input of the bash command.

Run any bash script off the internet

curl -L | bash

The above command will use an install script for Perl off the internet and run it on your Mac.

Install Perl locally via an online install script

Run a script from Gist and pass an argument

curl -sL http://script/location | bash /dev/stdin arg1 arg2

Bourne shell also supports -s to read from stdin.

curl -sL http://script/location | bash -s arg1 arg2

For example, the following command runs the script to create a virtual host file while also passing it the argument ‘’ which is needed for the creation of .conf file and /var/www/ directory.

curl -L | bash /dev/stdin