Installing osm2pgsql

I was brewing osm2pgsql, which in the process (and without my permission) started to upgrade Postgres from 10.8 to 11.3. At the end of the process, the upgrade of database failed and I received this error:

Error: Upgrading postgresql data from 10 to 11 failed! 
==> Removing empty postgresql initdb database...
==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/v
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
Error: Failure while executing; `/usr/local/opt/postgresql/bin/pg_upgrade -r -b /usr/local/Cellar/postgresql@10/10.8/bin -B /usr/local/opt/postgresql/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres -j 12` exited with 1.

I receive this message in the log file:

"pg_dump: [archiver (db)] query failed: ERROR: could not access file “$libdir/postgis-2.4”: No such file or directory"

It seems the problem is somehow with upgrading or migrating postgresql. So, initially I have posted a question here, which so far, have received no useful replies.

I need my data desperately, and I have these initial questions:
First, Is there any way to redo this installation and go back to the previous settings, i.e., postgres 10.8?
Second, if that is not possible, is there anyway to get this upgrade done manually?
Third, if none of above is possible, then is it possible to create a new database and import data from the legacy databases in that? On my server I had several databases.

I am not very advance with terminal and this kind of low level settings, so help explained in simple language would be most appreciated.