I used Ruby on Rails on Red Hat server. When I trying to generate a controller file, I got this error:
[ec2-user@ip-172-31-22-128 testApp4]$ rails generate
I took a look at the library that's trying to write the pid file, lib/spring/env.rb.
The function in question tries to create a temporary directory at the same location each time unless the XDG_RUNTIME_DIR is set:
path = Pathname.new(File.join(ENV['XDG_RUNTIME_DIR'] || Dir.tmpdir, "spring"))
Setting said variable to a unique directory does the trick for me:
export XDG_RUNTIME_DIR=/tmp/`whoami`