It looks like the error "PostgreSQL is not running". It seems that it was due to the restart of the PC, but it was solved by the following method. Although I have encountered it many times, I felt that I was checking the recovery procedure every time, so I will record it.
① Go to the front of the log file output by PostgreSQL
$ cd /usr/local/var/log
② Check the contents of the file
$ cat postgres.log
↓↓↓
lock file "postmaster.pid"Many were displayed as already exists.
#### **`postmaster.I heard that the pid file already exists, so I deleted it.`**
```I heard that the pid file already exists, so I deleted it.
④ Delete the file with the rm command
$ rm /usr/local/var/postgres/postmaster.pid
After the deletion, I was able to execute rails new safely.
## result
postmaster.pid is a mechanism to prevent multiple servers from being started, and it seems that it is created when the server is started and deleted when it is stopped.
If the server is not stopped normally, files may remain, which leads to an error like this one.
Recommended Posts