Fixing “Client ‘foo’ can only be used from host ‘bar.local’ problem on Mac

Quick problem fix; there are some strange problems with P4V on Mac OS X which causes a spurious change to the host name in client specifications; everything works fine until one day you fire up P4v and get the error “Client ‘foo’ can only be used from host ‘bar.local”….I’ve found a couple of references to this on various fora but nothing that seems to solve it directly. NOTE: I run P4 locally on my machine and only use it for my own (local) revision control. As I mention below I doubt if this problem occurs if you’re running P4 on a proper networked server….

Anyway, I have a fix that works for me and it’s simple; run p4 to edit your client spec (‘foo’ in my example) and remove the line containing ‘Host‘…That line restricts access to a given host and is the one that seems to get “creatively altered” somehow to add a “.local” extension to it. Remove this restriction and all works.

HOWEVER: this fix assumes you don’t need host restriction which you might, of course. I suspect it might not be a problem for you anyway then since you’ll be using something like a properly resolved IP or network name…so there.

Advertisements

10 thoughts on “Fixing “Client ‘foo’ can only be used from host ‘bar.local’ problem on Mac

  1. Thanks a lot. I was using the perforce java API and couldn’t get it to run on Solaris where I had this issue, but on Windows it was fine. This solved it.

  2. If you do need/want host restriction simply set the P4CLIENT environment variable (i.e. P4CLIENT=mypc) and ensure you have a matching ‘host’ in your p4 client (i.e. Host: mypc).

    Under Mac OS, your domain is “creatively altered” whenever you connect/disconnect from an AD managed network. When you’re connected to the network your hostname will be mypc.mycompany.com; when you disconnect, your hostname will instantaneously change to mypc.local.

    Hope that helps!

    Nathan

      1. Doesn’t work for P4V, because it runs from the desktop, which isn’t aware of environment variables in the shell.

      2. Still haven’t had a chance to check this…I am pretty sure it worked with p4v for me but I’ll go back and double check…(I have since switched to Git and am no longer working on a Mac)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s