Connect To Your Raspberry Pi From a Mac 🧰
Published: 2020-12-16 20:17:36

##Your Laptop and Raspberry Pi connected
You are close to making this happen. Your [Raspberry Pi OS is already copied onto an SD card](https://dev.to/stankukucka/how-create-raspberry-pi-os-using-raspberry-pi-imager-9m0) (as explained in previous tutorial) and plugged into a Raspberry Pi slot. There are a few steps to make this piece of tiny hardware work for you. So let's make this magic real, let's slice and dice it whole.

##Enable SSH on Raspberry Pi
In this step, you definitely need to connect your Raspberry Pi into power with Micro-USB-B on one side with standard USB on other side and plugin at least a USB mouse and yeah, don't leave your HDMI port empty to plug in some monitor too. The whole Raspberry OS should boot into the nice and tight interface. Click on the berry icon on the very left top corner and lead your mouse to <code>Preferences > Raspberry Pi Configuration</code> as seen on the next screenshot.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/itu0lqchfkrtn13v486l.png)

This window will pop-up in the middle of your screen. There is a place to rename your Raspberry device in the section named as Hostname or keep it default as <code>raspberrypi</code>. Remember this Hostname serve device connection in connection command, so if you rename it here don't forget to rewrite in command too. Example for SSH connection where whole command to serve device is pi@raspberrypi.local, but will come to this point later.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nphil3tlv48o0wmi5swl.png)

To activate SSH click on the <code>Interfaces</code> on the top part of the window and press the radio button <code>Enabled</code> where SSH info is mentioned. SSH itself will help us to connect to Raspberry via terminal when it is connected to local network via UTP cabel or via wifi without monitor plugged into device later on.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wup24aym0o6h2mr0fdmf.png)

##Plug in Raspberry
There are two ways how to plug in your "razz" into the network. The first and the starting step as we are going to with is our first choice. Connect via UTP cable, in case we have the same port on the laptop.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jkkn4b7308ld7r8agpaq.png)

##Connect to Raspberry
There is no need to identify the IP address of your Raspberry Pi device. Just simply use SSH command and try to connect to <code>raspberrypi.local</code> with this command hereunder.

```
ssh pi@raspberrypi.local
```

You'll be notified with this command hereunder.

```
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
```

Type <code>yes</code> and you'll be asked for password.

```
pi@raspberrypi.local's password: 
```

Default password to Raspberry device is <code>raspberry</code>

Now type <code>exit</code>

In this step we are going to get rid of the default password to make it more safer. So you'll log in again into Raspberry Pi via SSH, but with the additional command <code>passwd</code> to set up a new password.

```
ssh pi@raspberrypi.local passwd
```

Pass the whole process of changing the actual password into the new one.

##Turn on Wifi
If you are looking for wifi activation you should be already connected to Raspberry via SSH on UTP cable. Then paste this command to activate the configuration interface in the terminal.

```
sudo raspi-config
```

This <code>Software configuration tool</code> will show up. Just select the first option as follows <code>1 System Options</code>.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cbijohc6hv8ys0k025mb.png)

Then head to <code>S1 Wireless LAN</code> to setup wifi to connect to.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6nn4k0fga4yhde8m0ik5.png)

You'll be asked for SSID as the name of the wifi.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l1qryn185v7my4h2bz9l.png)

Enter passphrase to log into wifi.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z8ubo1rtc56nwaxandj0.png)

Here will system freeze for a while then after you confirm the password just press simple <code>FINISH</code> in the main interface.

##Connected over wifi
Now you can unplug UTP cable and let connect to your Raspberry Pi over SSH again. Your laptop and Raspberry Pi needs to be on the same wifi. You'll be notified by this informations hereunder.

```
Warning: Permanently added the ECDSA host key for IP address 'HERE IS YOUR MAC ADDRESS' to the list of known hosts.
```
And just enter the password to get into your "Razz" again. Be ready to follow this process anytime you reinstall the system of your laptop in other words connect to Raspberry Pi over UTP cable first, set up a wifi connection, and then you can easily realize an SSH connection via wifi.

##Ready to roll with your "Razz"
Now is your Raspberry fully connected via wifi (or you can connect via UTP cable if you prefer). Check how long the device is up with this command.

```
uptime
```
You can disconnect from the device with <code>exit</code> command when you'll stop the connection, but Raspberry Pi will still keep running.

```
exit
Connection to raspberrypi.local closed.
```

Or to turn off the device entirely with a simple command.

```
sudo halt
```
To give your Raspberry time to rest for your next upcoming projects.

Thanks to [Harrison Broadbent](https://unsplash.com/@harrisonbroadbent?utm_source=unsplash&utm_medium=referral&utm_content=CreditCopyTextGratitude) for the cover image from Unsplash.