Mac Command Line Interface for Desktop App


The Desktop App 3.3.0 for Mac comes with a brand new Mac Command Line Interface (CLI) for Egnyte Admins and users. The CLI can be used to add, reconfigure, remove drives, setup Connected Folders, mark or unmark folders for offline access, adjust proxy settings, and more. It's easy and scriptable! Get started by opening your Terminal and typing in egnytecli.

Commands

egnytecli is self-documenting. Run egnytecli for a list of supported commands. You can also see them below.

Screen_Shot_2019-05-09_at_6.33.56_PM.png

Available Commands:
  + drives             drives operations like connect/disconnect/add/remove a drive 
  + uploads            information from uploading files like recently uploaded and skipped
  + offline            offline folders operations like mark/unmark folders for offline
  + connected-folders  setup Connected Folders
  + proxy              proxy settings
  + logs               turn on debug logging

At each sub-level command, type -- in the end to get additional documentation to guide you to the appropriate actions.

egnytecli drives add egnyte --

Screen_Shot_2019-05-10_at_1.42.09_PM.png 

This example below will launch the UI to add a new drive and configure the drive with these following parameters:

  • Drive label: Acme
  • Domain: thoangfiles
  • Username: thoang
  • Cloud start path: /Shared/
egnytecli drives add Acme --domain thoangfiles --username thoang --cloudStartPath /Shared/ --openSession

y86ZDquL8q.gif

Here is a different example to sync a local folder Documents with another folder on Egnyte.

egnytecli connected-folders add egnyte ~/Documents /Private/::egnyte_username::/Documents

 M2ryU4Ew4V.gif

 

Troubleshoot

The default location for most application's CLI is in the /usr/local/bin folder. Sometimes, the CLI is not installed correctly due to permission issues on the bin folder in MacOS.

Egnyte CLI is installed as soon as the application starts. To verify that CLI was installed correctly, open terminal and run:

egnytecli

 If the output looks like this:

bash: egnytecli: command not found

It means that there were some issues while creating a link in the/usr/local/bin folder, which refers to the CLI binary. The most common reason for that is a lack of write permissions to the aforementioned folder. This can be verified by running the following in the terminal.

ls -l /usr/local | grep bin

 The output may look similar to:

drwxrwxr-x 99 kkapitan admin 3168 Jan 17 13:09 bin 

There are two possible cases here:

1) Incorrect owner

The third column (in this case "kkapitan") signifies the owner of a folder, so if it differs from the user shown after typing:

whoami

It needs to be changed. One way to do that is to type (it may require an additional password. Try the one used to login to your account or contact your Administrator):

sudo chown [YOUR_USERNAME_GOES_HERE] /usr/local/bin 

 Verify if everything went correctly by typing: 

ls -l /usr/local | grep bin

The third column should now contain your username. Restart the Egnyte Connect application and the CLI tool should be installed correctly.

2) Missing write permissions

If the owner matches your username, it may be a case that your username lacks write permissions to that folder. To check that run:

ls -l /usr/local | grep bin

Now check the output which may look similar to:

drwxrwxr-x  99 kkapitan admin  3168 Jan 17 13:09 bin

Pay attention to the first column containing drwxrwxr-x. These letters signify the permissions to that folder.

If the first four characters of this sequence look like dr– or dr-x, it means that write permissions are missing. One way to change that is to run the following (it may require an additional password. Try the one used to login to your account or contact your Administrator):

sudo chmod u+w /usr/local/bin

 Type again:

ls -l /usr/local | grep bin

And check if the starting sequence of the first column is drwx. Restart the Egnyte Connect application and the CLI tool should be installed correctly.

Additional note for admins

If for any reason you'd like to change the installation path from/usr/local/bin to some other, the CLI binary is located under:

/Applications/Egnyte\ Connect.app/Contents/MacOS/EgnyteDriveCLI

You can create a symlink to this binary using:

ln -s /Applications/Egnyte\ Connect.app/Contents/MacOS/EgnyteDriveCLI [YOUR_DESIRED_LOCATION]

Keep in mind that the destination should be added to the $PATH environment variable. It can be checked by running:

echo $PATH

 

Egnyte Community

Egnyte Community

Want to connect with other Egnyte users and our Egnyte team? Share ideas and ask questions in our Community .