Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2025.1

# Define a client workspace and bind it to the stream

A client workspace is the set of directories on your local computer where you work on the file revisions that P4 Server manages. Assign your workspace a name and specify a workspace root where you want local copies of depot files stored. The client workspace name defaults to the hostname of the computer on which your client is running. For details, see Configure a client workspace.

Before you can work in a stream, you must bind (associate) your workspace with the stream. When you associate a workspace with a stream, P4 Server generates the workspace view based on the structure of the stream. To learn more, see Configure workspace views.

To create a workspace and bind it to a stream:

1. Set the P4CLIENT environment variable to desired workspace name.

   On Linux-based operating systems

       export P4CLIENT=bruno_ws

   On Windows

       set P4CLIENT=bruno_ws

2. Use the `p4 client` command to bind your workspace to the stream.

       p4 client -S //JamCode/main

   The `-S` option specifies the name of the associated stream.

   P4 Server opens the client specification (spec) in an editor:

   Copy

       # A Perforce Client Specification.
       #
       #  Client:      The client name.
       #  Update:      The date this specification was last modified.
       #  Access:      The date this client was last used in any way.
       #  Owner:       The Perforce user name of the user who owns the client
       #               workspace. The default is the user who created the
       #               client workspace.
       #  Host:        If set, restricts access to the named host.
       #  Description: A short description of the client (optional).
       #  Root:        The base directory of the client workspace.
       #  AltRoots:    Up to two alternate client workspace roots.
       #  Options:     Client options:
       #                      [no]allwrite [no]clobber [no]compress
       #                      [un]locked [no]modtime [no]rmdir
       #  SubmitOptions:
       #                      submitunchanged/submitunchanged+reopen
       #                      revertunchanged/revertunchanged+reopen
       #                      leaveunchanged/leaveunchanged+reopen
       #  LineEnd:     Text file line endings on client: local/unix/mac/win/share.
       #  Type:        Type of client: writeable/readonly.
       #  ServerID:    If set, restricts access to the named server.
       #  View:        Lines to map depot files into the client workspace.
       #  ChangeView:  Lines to restrict depot files to specific changelists.
       #  Stream:      The stream to which this client's view will be dedicated.
       #               (Files in stream paths can be submitted only by dedicated
       #               stream clients.) When this optional field is set, the
       #               View field will be automatically replaced by a stream
       #               view as the client spec is saved.
       #  StreamAtChange:  A changelist number that sets a back-in-time view of a
       #                   stream ( Stream field is required ).
       #                   Changes cannot be submitted when this field is set.
       #
       # Use 'p4 help client' to see more about client views and options.

       Client:         bruno_ws

       Owner:          bruno

       Host:           dhcp-133-n101.dhcp.perforce.com

       Description:
           Created by bruno.

       Root:           /Users/bruno/tutorial

       Options:        noallwrite noclobber nocompress unlocked nomodtime normdir

       SubmitOptions:  submitunchanged

       LineEnd:        local

       Stream:         //JamCode/main

       View:
           //JamCode/main/... //bruno_ws/...

   The workspace root is the highest-level directory of the workspace under which the managed source files reside. To learn about the workspace root, see Define a client workspace. To learn about other settings, see Configure workspace views.
   When you have configured the workspace root directory and any other settings, save any changes and exit the editor.
   The output is:

       Client bruno_ws saved.

3. Verify that your workspace has been created, with the `p4 clients` command.

       p4 clients -S //JamCode/main

   This produces the following output:

       Client bruno_ws 2025/02/22 root /Users/bruno/tutorial 'Created by bruno.'

Your search for returned results