homebrew PostgreSQL upgraded to 10.1 but I need 9.6 I did brew update and brew upgrade

Now my PostgreSQL is 10.1
On the server I have 9.6 and I want it to be the same.

I can connect and read my data now still (as I assume the brew service didn't restart, but I didn't run pgupgrade or anything yet)

Also found packages as

brew search postgres


I have 

$ brew search postgres
==&gt; Searching local taps...
postgresql ✔     check_postgres   postgres-xc      postgresql@9.4   postgresql@9.5   postgresql@9.6   postgrest


What is the best and safest way to downgrade the package, save my current database and make postgresql@9.6 run? As I would like a version identical with the server we are working on (9.6), and I would like to make sure pg_upgrade never made it "PostgreSQL 10".

Is there any safe way to downgrade? I could do it on Linux from a description but the Mac+homebrew postgres user management works differently (for example doesn't use a postgres Unix user)
Had the same problem and found this from https://jaketrent.com/post/downgrade-previously-installed-brew-formula/


brew install postgres@9.6
brew switch postgres 9.6.3
brew info postgres // prints summary that should show no conflicts
brew services start postgresql // if desired, of course.