Connecting Omarchy with MacOS locally

I finally managed to get my 2017 Macbook up and running on Omarchy.

One of the first things I wanted to get sorted was syncing files quickly between my "main Macbook (M1 2020 Macbook) and my Omarchy (the 2017 Macbook)

This is how I did it.

First I needed to allow for external login on my Mac, and figure out the hostname. See my previous article on this.

After this is done, I needed to figure out my Omarchy hostname. In my case it was "archlinux".
One can figure this out by running hostnamectl in the terminal and grabbing the "Static hostname" and adding a ".local" afterwards.

So in my case it was like following: command syncs
My MacOS host name was: macbookpro.local
My Omarchy host name was: archlinux

To simply connect from the Omarchy to my mac, i could do the following:

ssh eddie@macbookpro.local where eddie is my username, and typing my password when prompted.

How about the other way? Connecting to my Omarchy from the MacOS?

First I needed to install openssh. I did it via the alt-super-space - «install» - «package» and «openssh».

Start the SSH daemon (immediately)
sudo systemctl start sshd

Enable SSH at boot (optional but recommended)
sudo systemctl enable sshd

Confirm it’s running
systemctl status sshd

Then I can connect from the MacOS like this:

ssh eddie@archlinux.local where eddie is my Omarchy user and typing my password when prompted.

Moving files from the MacOS to Omarchy

First off I install rsync. On Omarchy I do that via the install packages solution again, and on the MacOS I use Homebrew.

Now, as an example I'll mode the folder /Documents/example from my MacOS into my /Documents folder on my Omarchy. 

In this case I am in the /home/eddie directory on my Linux - meaning one level above the /Documents folder.

Running the following rsync command syncs the folder from the MacOS to the Linux machine, and now I have the example folder within the Documents folder on my Linux. (tips: run the rsync command with --dry-run as a parameter to test before running it)

rsync -av eddie@macbookpro.local:~/Documents/example Documents

Making it better. ssh-key instead of typing password every time

For this you’ll need an ssh key on each computer.

To create, run: ssh-keygen -t ed25519
continue and add a passphrase if you want (I didnt)

Once created on the Linux machine, add it to the mac like this:

ssh-copy-id eddie@macbookpro.local

Now the Linux ssh-key is inserted to the mac, and allows access without the password.

Test like this:
ssh eddie@macbookpro.local
Now it should work without password prompt.

How about the other way? Connecting to the Linux from MacOS?
Same process. Make ssh key and add it the other direction:

I made a new dedicated ssh key for this:
ssh-keygen -t ed25519 -f ~/.ssh/ided25519arch -C "mac->arch"

Add a clean SSH config entry
Edit ~/.ssh/config on the mac and add this:

Host omarchy   
   HostName archlinux.local   
   User eddie   
   Port 22   
   IdentityFile ~/.ssh/ided25519arch   
   IdentitiesOnly yes

Copy the key (will ask for your Linux password once)
ssh-copy-id -i ~/.ssh/ided25519arch.pub omarchy

After this now I can just type ssh omarchy and it should work without password prompt.

That same setup from the linux to mac:
edit the ~/.ssh/config

And add:

Host mac    
   HostName <YourMacName>.local    
   User <YourMacUsername>    
   IdentityFile ~/.ssh/id_ed25519    
   IdentitiesOnly yes

After this just type:
ssh mac to connect to the mac from the linux machine.

Updated Rsync

Before:
rsync -av eddie@macbookpro.local:~/Documents/example Documents

After:
rsync -av mac:~/Documents/example Documents

Linux to mac:
rsync -av omarchy:~/Documents/example Documents

The next steps will be to make simple aliases for dumping files from the one machine to the other, like Derek Sivers has explained here.