Recently, I've been doing side projects using a Raspberry Pi (RPi). There's a lot of sensors, devices and tools you can connect to a RPi. The benefits of using an RPi includes its size, wifi connectivity, and power consumption. Those three are major factors why I suggest using an RPi that involves sensors and monitoring devices. One problem I faced is connecting to the RPi without setting up a network/router. I wanted a direct connection from a laptop to the RPi. In my case, I use a 2016 MacBook Pro which uses a USB-C to Ethernet adapter. I just want to share how I was able to connect to the RPi via SSH with a direct ethernet connection from my Mac to the RPi.
First, get an ethernet cable.
Hook it up to your Mac and RPi.
Turn on the RPi.
Next, configure your Mac. You must enable Internet Sharing on your Mac.
To do that, go to System Preferences > Sharing.
While Internet Sharing is turned off, select where you want to Share your connection from. In my case, it's USB 10/100 LAN.
Tick the checkbox to enable Internet Sharing.
After that, go to System Preferences > Network.
Select the connection to your RPi on the left pane. Make sure Using DHCP is selected on the dropdown.
Next, you should be able to see that you are connected.
Once it's connected, we move on to the terminal.
Open your terminal, go to Applications > Utilities > Terminal. Or, open up Terminal using spotlight search. You can use your favourite terminal if you have one. I personally use iTerm.
Type in ifconfig, and look for bridge100.
Look for the inet field. For me, I'm getting 192.168.2.1
Next, type in
nmap -n -sP -PS22 <Your IP Address>/24
Now, you will see the other IP address connected to your machine. In this example, I get 192.168.2.3.
You can now use SSH to connect to the RPi using that IP Address.
Type in your password, and you're good to go.
Good job! You should be connected to your RPi by now.