Skip to content

OSX_Client

hevnsnt edited this page Jun 15, 2016 · 2 revisions

I found this write-up for compiling the Wallet on OSX, but I have NOT TESTED IT YET. If you test, please let @billswearingen know how it went for you. Thanks!

[Note: Pro tip, when you're in Terminal on a Mac and you don't want to have to type a huge path in, remember you can drag folders or files into the terminal window and it'll automatically put the correct path.]

  1. You need to install all of the dependencies on your computer; this includes:
  • libminiupnpc
  • openssl
  • libboost
  • libdb 4.8 (aka Berkeley DB) [Note: This is NOT the most current version.]

To install those, you'll want to install either MacPorts or HomeBrew (I prefer HomeBrew). These are essentially the Mac equivalent of "apt-get" from the Linux environment and make it easy to install packages. Then just google "homebrew libminiupnpc," etc., to get the correct syntax for installing each library (this is all done via Terminal).

  1. You need to download and install the QT SDK version 4.8 and QT Creator 2.5.2. I tried doing this with the latest versions (5.0 and 2.7.3 respectively) and had a bad time.

  2. Download the complete source code for the client you want to compile.

  3. Open the "xxcoin-qt.pro" file (where "xx" is the name of your coin) in the root directory of the source code with QT Creator.

  4. Choose "Build" and "Build xxcoin-qt." (I think I'm glossing over some steps here,... I'll edit with more info when I do the next client.)

  5. Find the .app file generated by QT Creator. It should run correctly on your computer since you have all the dependencies installed, but it won't run on anyone else's who doesn't have them. If you don't care, then you're done at this point.

  6. To make it run on other people's computers without the dependencies, you'll have to right-click the .app file you built, choose "Show Package Contents," and go into the Contents directory. Now take a look in the same directory of the Mac clients you already have (can be my mincoin one, or the official bitcoin or litecoin ones). Notice that your newly built .app is missing the "Frameworks" and "Plugins" directories under "Contents." Copy them straight over from one of the official apps. Also copy over /Contents/Resources/qt.conf to the same location in your app. Notice in /Contents/Resources the file bitcoin.icns which is the icon - you can change that to whatever icon you want.

  7. Okay, now you have all the dependencies in your .app but the .app doesn't know to find them there - if you were to give this .app to someone else, it would look for them in the normal places they would be installed if that person was to use HomeBrew or MacPorts to download them. To fix this we need to use a combination of "otool" and "install_name_tool." For example, to check where the app is looking for dependencies, type in terminal:

otool -L /Applications/MinCoin-Qt.app/Contents/MacOS/MinCoin-Qt

This is assuming that you put your newly compiled app into the Applications folder. Change names and locations as needed. You should get a list of all the dependencies and their locations. Now repeat that for one of the already-built clients. Notice the difference? Instead of looking for libminiupnpc, libssl/libcrypto (part of the openssl package), and libboost in absolute paths in their installation directories, the already-built clients are pointing to "@executable_path/../Frameworks/[library file]". This tells the app to look for the library in the Frameworks directory. To make the change you execute the following:

install_name_tool -change [old path] [new path] [application location]

For example, if I were changing the libboost_thread-mt.dylib reference, and my application was in /Applications I would run:

install_name_tool -change /usr/local/lib/libboost_thread-mt.dylib @executable_path/../Frameworks/libboost_thread-mt.dylib /Applications/MinCoin-Qt.app/Contents/MacOS/MinCoin-Qt

(Obviously that example is for fixing the mincoin-qt client - you would change the name for whatever client you are fixing.)

Repeat that for each dylib that otool lists. In the end, otool -L should look identical between your freshly made app and one of the pre-built Mac ones.

Clone this wiki locally