Bitcoin Forum
April 19, 2024, 07:55:52 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to make a portable Bitcoin client for Mac OS X!  (Read 2993 times)
Pygy (OP)
Newbie
*
Offline Offline

Activity: 47
Merit: 0


View Profile
June 13, 2011, 11:22:54 AM
Last edit: June 15, 2011, 07:51:09 PM by Pygy
 #1

The wallet switching user experience is currently sub par on all platform. You must either manipulate folders (and risk screwing up) or use the command line.

I offer here a nicer solution for Mac Os X: Use one Bitcoin.app per wallet, and put the wallet inside the application bundle.

It creates a standalone, portable Bitcoin.app that can be copied around and run as is on any Mac, or stored on an encrypted partition.

Here's the procedure to create a new, empty wallet (it could be automated, but I'm not there yet).

1) Create a copy of the Bitcoin.app and put it in your encrypted partition (let's call it BitSafe.app, for a "bank safe"-type wallet).

2) open the terminal (Terminal.app) and type
Code:
cd /Path/To/Your/Encypted/Volume/BitSafe.app/Contents/Resources
mkdir data
cd ../macOS
cat > start.sh
#! /bin/sh
dir1=$(cd "$(dirname "$0")"; pwd)
dir=`echo $dir1 | sed 's/"/\\"/g' | tr -d '\n'`
data="$dir/../Resources/data"
"$dir"/bitcoin -datadir="$data"
then press ctrl + d.

3) Again, from the prompt, type chmod +x start.sh to make the script executable.

4) now, we must edit the Info.plist file in order to tell OS X to launch our script instead of directly running the bitcoin binary. Type nano ../Info.plist . From there, find the following lines
Code:
	<key>CFBundleExecutable</key>
<string>bitcoin</string>
and replace bitcoin with start.sh .

You should also change the Bitcoin strings corresponding to the CFBundleDisplayName and CFBundleName to BitSafe (or whatever strikes your fancy). This will change the Application name in the menu bar.

Once you're done, press ctrl + o, return then ctrl + x

6) Save a backup copy of the file (it will wake it easier to create new integrated App+Wallet bundles).

You can now open BitSafe.app. A new wallet will be generated inside BistSafe.app. You can have as many of them as you like, and you can move them around for backups and so on.



If you want to copy an existing wallet (located by default in /Users/YourUserName/Library/Application Support/Bitcoin), you must go inside the Bitcoin.app package. From the Finder, right click on Bitsafe.app and pick the "Show Package Contents" option. It will an open new Finder window. From there, go to Contents/Resources/data . You can paste your wallet.dat and other resource files here.



Updating the Bitcoin client:

If a new version of the BitCoin client is released, you can update the binary inside the Bundle. Right click the new Bitcoin.app file and choose Show Package Contents. From there, copy the bitcoin file located in Contents/MacOS/ file and paste it at the same place inside the BitSafe.app package.



Note: I've tried to change the LSMultipleInstancesProhibited from true to false, but it doesn't allow to run multiple Bitcoin clients simultaneously (even if I change the CFBundelIdentifier entry). I'd love to know if it is possible to overrule that behaviour?

Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713556552
Hero Member
*
Offline Offline

Posts: 1713556552

View Profile Personal Message (Offline)

Ignore
1713556552
Reply with quote  #2

1713556552
Report to moderator
1713556552
Hero Member
*
Offline Offline

Posts: 1713556552

View Profile Personal Message (Offline)

Ignore
1713556552
Reply with quote  #2

1713556552
Report to moderator
1713556552
Hero Member
*
Offline Offline

Posts: 1713556552

View Profile Personal Message (Offline)

Ignore
1713556552
Reply with quote  #2

1713556552
Report to moderator
Jessy Kang
Newbie
*
Offline Offline

Activity: 28
Merit: 0



View Profile
June 15, 2011, 09:46:21 AM
 #2

Would the final result of this effectively be portable? I could put in on a USB and run it on any Mac?
Pygy (OP)
Newbie
*
Offline Offline

Activity: 47
Merit: 0


View Profile
June 15, 2011, 03:54:01 PM
 #3

Yes, it will :-).

It has two drawbacks, though:

It stores not only the wallet but also the block chain cache, which is grows as time goes by, inside the app.

Furthermore, If you don't use a client+wallet bundle often, when you launch it, you have to sync download all the keychain blocks that have been since the last use, or you'll have to copy them manually, which means that you risk to mess up and overwrite the wallet.

I've written a new script that that only stores the wallet and creates a symlink in the ~/Library/Application Support/Bitcoin, but I haven't tested it yet (and I'm not home right now).
hank
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
August 01, 2011, 04:53:03 AM
 #4

Thanks so much for this write-up. I've got a handy usb-key wallet now. The program is a little laggy running off the drive but it works and that's what matters. As an added bonus you can add other arguments to the last line of the script which (imho) is much easier than monkeying around with a .conf file.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!