How to set client root in Perforce P4 when client unknown error comes

It looks like your p4settings.txt config file isn't being used; otherwise the client name returned by "p4 info" would match the P4CLIENT value in the config file. Run:

p4 set P4CONFIG=p4settings.txt

and make sure that when you run "p4 info" you're doing it from a directory underneath ~/dev/trunk. (Your "p4 info" output in the question shows your current directory as /Applications, so that might explain the problem on its own -- just do "cd ~/dev/trunk" and try again.)

The "client unknown" error suggests that maybe your client spec got deleted (this is assuming you're connecting to the same server and using the same client name you were successfully using before). If that's what happened you can create a new one with the same name by running:

p4 client

Try p4 set p4client=my_client.

This stores your preferred client in the registry. There are other ways to set your client, with different precedence and scope:

  • environment variables (potentially different per process)
  • P4CONFIG files (potentially different per filesystem location)
  • command-line options (potentially different for every invocation of p4.exe)

but for simplicity, using p4 set is all you should need.

BTW, P4V uses its own setting (there's a dialog that comes up by default when you start P4V).