Mining Ethereum with Mac: Beginner Guide

Raptor Kwok
4 min readDec 27, 2017

Ethereum is an open-source, public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality. It provides a decentralized Turing-complete virtual machine, the Ethereum Virtual Machine (EVM), which can execute scripts using an international network of public nodes. (from Wikipedia)

To start mining with Mac, you need the followings:

  1. macOS 10.10+
  2. Internet connection
  3. An Ethereum wallet (no worry, you can obtain one in Step 2)
  4. lots of patience (there are only 4 steps in this guide, be sure to read it through)

Step 1: Install Geth, the Command-line Interface (CLI) for Ethereum mining

Issue this command in Terminal (access Terminal via Spotlight, or in Applications > Utilities) :

bash < (curl https://install-geth.ethereum.org)

After few minutes, the command geth will be installed. Alternatively if you have Homebrew installed, you can install Geth via:

brew tap ethereum/ethereum
brew install ethereum

Step 2: Obtain a Ethereum wallet

There are a lot of Ethereum wallets in the Internet, you can obtain one from Ethereum official website or Freewallet. I prefer the latter one, as it has mobile App interface.

Once you obtained the wallet, it will display an address to receive money, for example:

0xe5476778d11e2128f66f44da8ceee956dacb3f4e

You can use this address to receive the earned Ethereum from mining.

Step 3: Setup Geth

Create your Geth account using:

geth account new

You’ll be prompted to enter a password for your new account.
REMEMBER this password. If you lose the password, you will not be able to access the account anymore.

Next we need to synchronize the Ethereum database with:

geth --syncmode="light" --cache=1024

It will take an hour to finish. After sync is complete, we can launch the Geth console (very powerful) :

geth console

The output will look like this:

INFO [12-27|16:05:44] Starting peer-to-peer node               instance=Geth/v1.7.3-stable/darwin-amd64/go1.9.2
INFO [12-27|16:05:44] Allocated cache and file handles database=/Users/miner/Library/Ethereum/geth/chaindata cache=128 handles=1024
INFO [12-27|16:05:44] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
INFO [12-27|16:05:44] Disk storage enabled for ethash caches dir=/Users/miner/Library/Ethereum/geth/ethash count=3
INFO [12-27|16:05:44] Disk storage enabled for ethash DAGs dir=/Users/miner/.ethash count=2
INFO [12-27|16:05:44] Initialising Ethereum protocol versions="[63 62]" network=1
INFO [12-27|16:05:44] Loaded most recent local header number=0 hash=d4e567…cb8fa3 td=17179869174
INFO [12-27|16:05:44] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869174
INFO [12-27|16:05:44] Loaded most recent local fast block number=0 hash=d4e567…cb8fa3 td=17179869174
INFO [12-27|16:05:44] Loaded local transaction journal transactions=0 dropped=0
INFO [12-27|16:05:44] Regenerated local transaction journal transactions=0 accounts=0
INFO [12-27|16:05:44] Starting P2P networking
INFO [12-27|16:05:46] UDP listener up self=enode://d121d375590c5d4f98ce8162d98667fa5808578237a11ae79192ed4a4c489010a754f115dffe7e0020677943984504a924e36a02ea86cf2ee25f80f91cbe4cf4@[::]:30303
INFO [12-27|16:05:46] RLPx listener up self=enode://d121d375590c5d4f98ce8162d98667fa5808578237a11ae79192ed4a4c489010a754f115dffe7e0020677943984504a924e36a02ea86cf2ee25f80f91cbe4cf4@[::]:30303
INFO [12-27|16:05:46] IPC endpoint opened: /Users/miner/Library/Ethereum/geth.ipc
Welcome to the Geth JavaScript console!
instance: Geth/v1.7.3-stable/darwin-amd64/go1.9.2
coinbase: 0x1ac992bbbb25d572506f0127b147f0ad89675097
at block: 4660759 (Sat, 02 Dec 2017 06:50:24 GMT)
datadir: /Users/miner/Library/Ethereum
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

There are few main things you can do in the the console:

  1. Manage accounts
  2. Start transaction (transfer credits) between accounts
  3. MINING !

Step 4: Start Mining

To start mining, issue this command:

> miner.start(8)
INFO [12-27|17:38:38] Updated mining threads threads=8
INFO [12-27|17:38:38] Transaction pool price threshold updated price=18000000000
INFO [12-27|17:38:38] Starting mining operation
INFO [12-27|17:38:38] Commit new mining work number=1 txs=0 uncles=0 elapsed=292.546µs

where 8 is the number of threads.

To stop mining, issue this command:

> miner.stop()

To obtain the current hash rate in H/s, you can use:

> web3.eth.hashrate
234567

which means you’re mining at 234,567 hashes per second.

That’s all you need for Ethereum mining. Easy peasy, right?

What’s Next?

We mentioned earlier that we can manage the accounts via Geth console. Here’s how to do so.

  1. List Accounts
> eth.accounts
["0x1ac992bbbb25d572506f0127b147f0ad89675396"]

2. Check Account Balance

After your hard work in mining, you will receive some Ethers in your coinbase. To check the account balance, you can use:

> eth.getBalance(eth.coinbase)
1552

That means you’ve 1552 Ether available for transaction.

3. Send Ether

First you have to unlock your coinbase in order to send Ether:

> personal.unlockAccount(eth.coinbase)
Unlock account 0x1ac992bbbb25d572506f0127b147f0ad89675396
Passphrase:

After you entered a correct passphrase, your coinbase will be unlocked and it’s available to send transactions.

Assume you want to transfer 1 Ether to your wallet, you can issue this command:

> eth.sendTransaction({from:eth.coinbase, to: '0xe5476778d11e2128f66f44da8ceee956dacb3f4e', value: web3.toWei(1, "ether")})
'0xeeb77b211e7d9be66232ed70c2eff1bcc5d5fd9ed61d776fbc5cff45b5bf8bf3'

The resulting transaction is 0xeeb77b211e7d9be66232ed70c2eff1bcc5d5fd9ed61d776fbc5cff45b5bf8bf3 . You’ll receive your amount in your wallet shortly.

4. Estimating the time required for finding a block:

> etm = eth.getBlock("latest").difficulty/web3.eth.hashrate;
> Math.floor(etm / 3600.) + "h " + Math.floor((etm % 3600)/60) + "m " + Math.floor(etm % 60) + "s";
1h 20m 30s

5. Exit the Console

To leave the console, use the following command:

> exit

That’s all for this beginner guide. If there is any questions, please ask in comment below.

--

--

Raptor Kwok

I write stuffs: novels, programs, mobile apps, journal papers, book chapters, etc.