Ssh connection refused error

I have a fresh install of OctoPrint 0.16.0.
Booted up my pi 3+ , setup wifi and enabled ssh via sudo-raspi config.
I also initially copied an empty file called ssh onto the boot disk.
Problem is I cannot get ssh access from my mac terminal, just this error message..
ssh: connect to host X.X.X.X port 2222: Connection refused
I can ping the ip address but cannot connect via ssh.
I know this issue has been raised a few times, I have tried all the suggestions and nothing seems to work.
Any help?

Hi @ozcam!

Are you sure with that port number? SSH usually uses port 22


Try this version instead. If it works then you can suspect that something has changed the default configuration on your Mac.

ssh -p 22 pi@octopi.local

This should return port 22 for the server side of your Mac's ssh: sudo cat /etc/services |grep "^ssh "

And ~/.ssh/config is where the default client side of ssh would be changed. You could add a paragraph for just OctoPi but it's possible that someone changed the global default to 2222.