Using the YubiKey Manager CLI

The YubiKey Manager - ykman - can be used to configure all aspects of the YubiKey. This section covers the options for accessing and launching the application.

Windows

Run the commands from Command Prompt or PowerShell. Either facilitate the running of ykman commands, or if your environment variable is not set to automatically find ykman, change directories. Instructions for both are given below.

Facilite Running ykman Commands

To enable running ykman commands without changing directories or updating environment variables, add an alias for ykman to your $PROFILE for PowerShell. To do this, run the following commands in PowerShell.

  1. Test for $PROFILE existence - output should return true

    PS> Test-Path $PROFILE
    
  2. If False is returned, make a $PROFILE

    PS> New-Item $PROFILE -ItemType File
    
  3. Create alias for ykman CLI, (32-bit)

    PS> Add-Content $PROFILE -Value 'Set-Alias ykman
    "C:\Program Files (x86)\Yubico\YubiKey Manager\ykman.exe"'
    
  4. Create alias for ykman CLI, (64-bit)

    PS> Add-Content $PROFILE -Value 'Set-Alias ykman
    "C:\Program Files\Yubico\YubiKey Manager\ykman.exe"'
    
  5. Reload $PROFILE by closing and re-opening PowerShell, or run the command

    PS> & $PROFILE
    

Change Directory

If your environment variable is not set to automatically find ykman, or you do not have a PowerShell alias set, change directory to the location of the ykman executables. For example, with Windows 64-bit version of YubiKey Manager installed, this would be C:\\cd "C:\Program Files\Yubico\YubiKey Manager\".

Launch ykman

You might need to scroll horizontally to see the entire command.

To launch ykman in GUI mode or CLI mode from the command line, select and run the command for one of the options listed below:

  • Launch ykman CLI, (32-bit)

    C:\>"C:\Program Files (x86)\Yubico\YubiKey Manager\ykman.exe"
    
  • Launch ykman CLI, (64-bit)

    C:\>"C:\Program Files\Yubico\YubiKey Manager\ykman.exe"
    
  • Launch ykman GUI, (32-bit)

    C:\>"C:\Program Files (x86)\Yubico\YubiKey Manager\ykman-gui.exe"
    
  • Launch ykman GUI, (64-bit)

    C:\>"C:\Program Files\Yubico\YubiKey Manager\ykman-gui.exe"
    

To launch ykman with debug logging enabled, add the following to the execution command:

--log-level DEBUG --log-file %USERPROFILE%\Desktop\ykman-log.txt

Example:

C:\>"C:\Program Files (x86)\Yubico\YubiKey Manager\ykman-gui.exe"
   --log-level DEBUG --log-file %USERPROFILE%\Desktop\
   ykman-log.txt

macOS

From the Mac’s Terminal application, run the listed commands as needed.

If you have installed ykman using Homebrew, referenced in the ykman Installation for MacOS, you do not need to change directories to run ykman commands in Mac’s terminal. The CLI will run as native commands.

Change Directory

Change directory to the location of the ykman executables. On macOS you must escape the space in the filename “YubiKey Manager.app” by putting in a backslash before the space, or you must enclose the filename in double quotes. Examples of both are given below:

cd /Applications/YubiKey\ Manager.app/Contents/MacOS/
cd "/Applications/YubiKey Manager.app/Contents/MacOS/"

Launch ykman

To launch ykman in GUI mode or CLI mode from the command line, run the command for the appropriate option:

  • Launch ykman CLI

    % /Applications/YubiKey Manager.app/Contents/MacOS/ykman
    
  • Launch ykman GUI

    % /Applications/YubiKey Manager.app/Contents/MacOS/ykman-gui
    

To run ykman with debug logging (to a file) enabled, add the following to the run command:

--log-level DEBUG --log-file ~/Desktop/ykman.txt

Example:

% /Applications/YubiKey Manager.app/Contents/MacOS/ykman
   --log-level DEBUG --log-file ~/Desktop/ykman.txt

Click for Yubico Support.