Failing to deploy my server locally on macOS

What I’m trying to do:
Hi all!
I created an app with the Anvil IDE, and I cloned it to my machine (macOS) in order to test it locally and check the deployment process as written in the docs, and continue to develop my app locally.

What I’ve tried and what’s not working:
I did the steps in the docs, and when I trued to run `anvil-app-server --app I get the error below:

Found Anvil App Server JAR in package directory
Failed to start built-in Postgres database: java.lang.IllegalStateException: Process [.anvil-data/db-bin/PG-a2a9bc65661eac6f108fc920268a87b3/bin/initdb, -A, trust, -U, postgres, -D, .anvil-data/db, -E, UTF-8] failed
More logs are available in .anvil-data/postgres.log.
Some common causes of this problem:
 - Are you launching this server as 'root' on a UNIX system? 
   Postgres will not run as root; try launching the server as an ordinary user.
 - Are you running this server on an unusual architecture or OS? (Mac OS X/aarch64)

so I looked at the logs and it says that:

no data was returned by command ""/<Path>/.anvil-data/db-bin/PG-a2a9bc65661eac6f108fc920268a87b3/bin/postgres" -V"
The program "postgres" is needed by initdb but was not found in the
same directory as "/<Path>/.anvil-data/db-bin/PG-a2a9bc65661eac6f108fc920268a87b3/bin/initdb".
Check your installation.

but those files are in the same directory and not as the log says, and I really don’t have any clue where to start try and fix it.

I’ve read a few discussions here about a similar issues and didn’t find what Im looking for in order to fix my problem. I’m new to Anvil and I’m testing it’s platform, but without the local deployment it’s useless to me, although I really liked it and want to use it.

I would really appreciate any detailed help with this matter. pls.

I faced the exact same issue on m1 MacBook Pro. I was able to get the the docker version to work though. Is Anvil on docker hub official? if you are familiar with how to use that .

1 Like

I’m not a Mac user, but another option with Anvil is to install Postgres separately (instead of using the embedded Postgres instance). With Postgres installed, in psql, configure something like this:

CREATE USER your_username WITH PASSWORD ‘your_password’;
CREATE DATABASE your_database;
GRANT ALL PRIVILEGES ON DATABASE your_database TO your_username;
ALTER USER your_username CREATEDB;
ALTER USER your_username WITH SUPERUSER;
\q

Run Anvil with the --database option, and your connection string. Something like this:

anvil-app-server --app App_Name --origin http://192.168.1.1:2121 --auto-migrate --dep-id C6ZZPAPN4YYF5NVJ=anvil_extras_main --database “jdbc:postgresql://localhost/your_database?user=your_username&password=your_password”