Question

I installed postgres using postgres.app from heroku and I need to have it on continuously when working on my app. I believe there wasn't anything running before when I used homebrew and I know sqlite doesn't need anything running in the background. Why must the app always be on for it to work? Thanks

Était-ce utile?

La solution

That's just the way Postgres.app is designed to work; it's a newer approach that's meant to be faster and easier than keeping track of launch daemons. (Kind of like how Heroku has made a lot of addons work with a single click, rather than lots of command line configuration -- it makes things simpler in 90% of cases, at the expense of the other 10%.)

Postgres is inherently a client-server structure, so using a Postgres database always involves effectively connecting to a server -- even if that server is localhost. In the case of Postgres.app, that server runs only while the app is running. In your earlier homebrew installation, it would have been a background process; even though you wouldn't see it running, it was there.

SQLite is a different beast; it uses a local file-backed store, rather than connecting to a server, so you're right that there's no background process to connect to in that case.

You can still get a traditional Postgres installation using MacPorts (as detailed here), or by compiling from source. Evidently it's also included as part of OS X Server. Any of those would be a background process rather than depending on a running app.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top