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

Once that is setup, then type the following code:

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:

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

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:

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

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:

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:

Replace them with:

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 millions 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 bitcoins out of my account.

Posted in Bitcoin, Programming
5 comments on “Custom ‘Vanity’ Bitcoin Addresses on Mac OS X 10.9
  1. Curt says:

    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.

    • Kevin says:

      Type the following command:

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

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

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

  2. Patrick says:

    How do I run the vanity gen program in the source folder?

  3. Jez says:

    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

    • Kevin says:


      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 Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Kevin Stanley-Adams

Hi! I’m Kevin Stanley-Adams

I am a final year control & systems engineering student living in Sheffield, UK

Post Categories

Music I’ve Been Listening To