

Using either tool, you will be able to specify a file path from the client-side perspective. If you're in a hurry, the above option is the simplest to get you going.Īlternatively, you can use either psql \copy command ( psql is a popular command line tool for interacting with Postgres) or the pgAdmin GUI.
Mac command line permission denied mac os#
I honestly didnt expect to find it: I thought they might reserve that for the Server version of Mac OS X, but no, there it was, man page and all. I could of course go get it, but instead I took a look on my Mac. And if the server is running remotely, make sure that the file path is something that can be accessed by the Postgres server user. Well, not on my main Linux server, because it apparently isnt important enough to install on spec.

If you're on a Mac or Linux, use the '/tmp' directory - again, this is accessible by all users. The Public user home directory is readable and writeable by all users on the system. If Postgres is on your computer, and you're running Windows for example, move the file you're trying to read temporarily to 'C:\Users\Public' or write your file out to this directory. The simplest option is to change the file location to one the server does have access to. Similarly, if the server is running remotely on another computer, it won't be able to access files for reading or writing on your own computer. It therefore can't read or write to files that, for example, reside under your own personal home directory. If the Postgres server is running locally on your computer, it will be running under a user account that's different from your own.

The COPY command is executed from the viewpoint of the server, not the client. The most common reason permission will be denied is because the Postgres server cannot access the file at the location you specified.
Mac command line permission denied how to#
When you're using these commands if you're getting a "Permission Denied" error, here's the likely reason why and how to fix it. If you are still having problems you can check the permissions on the file by running ls -l while in the same directory as the ruby script. Likewise, COPY TO is used to export data from a table or a query result to a file. You should never have permission issues there and there wont be a risk of it accessing or modifying anything critical to your OS. By taking this step, Disk Utility will work through your hard drive to detect broken or misbehaving permissions and list them for repair. Select Macintosh HD from the left sidebar menu. COPY FROM is commonly used to import data from a file (CSV, plain text, etc.) in to PostgreSQL. Press Command + Space to open Spotlight, type in Disk Utility, and hit Enter.
