- Download the Raspbian Lite image from https://downloads.raspberrypi.org/raspbian_lite_latest (add .torrent to get a torrent)
- Unzip the download to extract the .img file
- Insert a FAT32-formatted SD card, and copy the image over:
diskutil list
to identify the disk number, e.g./dev/disk2
diskutil unmountDisk /dev/disk2
sudo dd bs=1m if=image.img of=/dev/rdisk2
- Before unmounting, edit a couple of files to activate internet-over-USB. The image mounted for me at
/Volumes/boot
.- In
config.txt
, add this as the last line of the file:dtoverlay=dwc2
- In
cmdline.txt
, add this as a parameter, just after therootwait
parameter:modules-load=dwc2,g_ether
- In
- Unmount the SD card (via Finder) and stick it in the Raspberry Pi.
- Attach a USB cable from your Mac to the RPi via the "USB" port on the RPi. This should power the RPi, and it will start to boot up.
- Give it a few minutes to boot. Open the Network preference panel (System Preferences -> Network) on your Mac, and you should see a new networking device called something like "RNDIS/Ethernet Gadget". For now it should be set to "Configure via DHCP" - it will have a link-local address.
- Once the RPi boots, you should be able to SSH to it with
ssh [email protected]
. The password israspberry
. - Over SSH, edit
/etc/network/interfaces
to add a USB interface - add the following lines:
allow-hotplug usb0
iface usb0 inet static
address 192.168.2.2
netmask 255.255.255.0
gateway 192.168.2.1
- Next, set up
resolv.conf
to use192.168.2.1
for name resolution - edit/etc/resolvconf.conf
, and uncomment/edit thenameservers
line to readnameservers=192.168.2.1
. - Finally, on your Mac, configure the RNDIS/Ethernet Gadget interface with the following parameters:
- Configure IPV4:
Manually
- IP Address:192.168.2.1
- Subnet Mask:255.255.255.0
- Router: (none) - Under Advanced -> DNS, add your favorite DNS server, like8.8.8.8
or your home router. - Under the "Sharing" preferences pane, turn on Internet Sharing, and share your Mac's active network connection with the RNDIS/Ethernet Gadget interface.
- Reboot the RPi. After it comes back up, you should still be able to connect via
ssh [email protected]
, and the device should now have the IP address192.168.2.2
and access to the Internet!
Works nicely, except under step 4, create an empty file called ssh in the boot directory, because ssh is disabled in the newest Jessie image for safety reasons. This enables ssh.