Custom ‘Vanity’ Bitcoin Addresses on Mac OS X 10.9

Bitcoin addresses are generated randomly and consist of up to 35 alpha-numeric characters. There are 2160 possible different bitcoin addresses. To give that some perspective, there roughly 263 grains of sand on this planet. There are almost as many possible bitcoin addresses as there are atoms on earth. It is possible to have a custom address by randomly generating addresses until an address that meets the custom specification shows up. Github user samr7 has made a useful cryptographic brute-forcing tool that does exactly that, called vanitygen.

A windows 32 bit binary is available pre-compiled. However, I found it quite difficult to get to compile and run on the latest version of Mac OSX with the latest dependancies so I thought I’d make a quick guide. If you are running an older version of Mac OSX, you might not need to follow this guide, but you would still benefit from the performance increases from updating to the latest dependencies.

The tool requires the following dependencies:

  • OpenSSL
  • pcre/pcre++

OpenSSL is an open source implemetation of the TSL/SSL programs and is needed to use SHA algorithms to generate the bitcoin addresses, and pcre/pcre++ are the libraries needed to compile the C code. OpenSSL 0.9.8y is included with Mac OSX. However, the latest available version, 1.0.1e has many improvements that allow for faster calculations (quite important when generating billions of bitcoin addresses to find a custom one). By upgrading to the latest OpenSSL, I was able to generate around 1.5 million bitcoin addresses per second using my CPU, as opposed to 600 thousand.

The easiest way to get the latest version of these dependancies on Mac OSX is to use a tool called homebrew, which downloads and installs tools, and then puts symbolic links into /usr/local to be added to your environment variables. To install homebrew, type the following into your Mac Terminal

ruby -e "$(curl -fsSL"

Once that is setup, then type the following code:

brew install pcre pcre++ openssl

This will install all 3 dependencies. However, an older version of OpenSSL is already installed. The new version must take precedance over the older version. To check which version is installed and taking precedance, type:

openssl version

Use this to tell homebrew to make the symbolic links to OpenSSL, despite there already being a copy installed:

brew link --force openssl

Now you need to edit your environment variables to check for homebrew installs before checking installs included with Mac OSX. This is done by putting /usr/local/bin at the start of your $PATH environment variable. To edit the $PATH environment variable, the file “.bash_profile” in your home directory needs to be edited. To create it if it doesn’t exist, and then edit it, use the following code:

cd ~;
touch .bash_profile;
open .bash_profile;

This will open the file in text TextEdit. To change the $PATH environment variable, put the following code at the end of the file:

export PATH=/usr/local/bin:$PATH

This prepends the homebrew installs to the start of the path. Restarting your computer will allow for these changes to take place. Now, all that needs to be done is download & compile vanitygen. First, download it by using the following code:

git clone

This downloads a copy of the source code into your working directory. I’m running Mac OSX 10.9, and had to make some changes for it to work. First, open pattern.h and change the line “#define INLINE inline” to “#define INLINE”.

A few simple changes need to be done to tell the file to use the homebrew dependicies. Open Makefile in TextEdit, and remove following lines:

LIBS=-lpcre -lcrypto -lm -lpthread
CFLAGS=-ggdb -o3 -Wall

Replace them with:

LIBS= -lpcre -lcrypto -lm -lpthread
INCPATHS=-I$(shell brew --prefix)/include -I$(shell brew --prefix openssl)/include
LIBPATHS=-L$(shell brew --prefix)/lib -L$(shell brew --prefix openssl)/lib
CFLAGS=-ggdb -O3 -Wall -Qunused-arguments $(INCPATHS) $(LIBPATHS)

Now navigate to the source code folder in Terminal, and type make all. This should compile vanitygen and allow you to create custom bitcoin addresses.

If your graphics card supports OpenCL, use oclvanitygen within vanitygen. It will allow you to use your graphics card which is usually much faster at hashing than the CPU. Using my laptop I can generate around 6 million addresses per second.

Making an address beginning with 4 case-specific characters, such as Love, takes less than a second on my laptop and generates around 4 million addresses in the process. The following wallet and private key were generated:

Address: 1LoveUqwqpzstMCRo5h98MQZwxJkvgYR3P
Privkey: 5KJPaYMeA3cabmwXqFvvA6XNn5YaHCG67UtxD9BXdgq3PaCrmMd

If this was a bitcoin address that I’d use personally, I would have to keep the private key to myself, otherwise anybody could take bitcoin out of my account.


  1. Do you recall having to do anything special to get the OpenCL going? I am able to compile the main program, but not the ocl version of the executable.

    1. Type the following command:

      ./oclvanitygen -p -d 1String

      This will then list the available graphics devices. Mine says:

      Available OpenCL platforms:
      0: [Apple] Apple
        0: [Intel] Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
        1: [Intel] HD Graphics 4000
        2: [NVIDIA] GeForce GT 650M

      So if I want to use my graphics card, I need to call the following command:

      ./oclvanitygen -p 0 -d 2 1String

      Let me know if this doesn’t work for you and I’ll try and work out what I did differently.

  2. any chance you can publish a link to download your compiled binary that i can run on mac osx as im not a coder (anymore) and dont have the developer tools nor ability to compile, yet i want to run this code on my mac. thanks.. Jez

    1. Hi,

      Unfortunately I don’t have access to a computer until December but feel free to message me then. Apologies for such a long time frame.


Leave a comment

Your email address will not be published. Required fields are marked *