I want to know how put some
/my/folder/path/ to Sidebar in
Devices section, from terminal?
Per this GitHub page, a tool named
sfltool can be used to add favorites. The tool is included with macOS El Capitan and later.
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///my/folder/path/
I used the
mysides tool to create a link to the Trash folder on my sidebar. You will need admin (or sudo) permissions to install mysides.
$ brew cask install mysides ==> Satisfying dependencies ==> Downloading https://github.com/mosen/mysides/releases/download/v1.0.1/mysides-1.0.1.pkg ==> Verifying SHA-256 checksum for Cask 'mysides'. ==> Installing Cask mysides ==> Running installer for mysides; your password may be necessary. ==> Package installers may write to any location; options such as --appdir are ignored. Password: installer: Package name is mysides-1.0.1 installer: Installing at base path / installer: The install was successful. 🍺 mysides was successfully installed! $ mysides add Trash file:///Users/bearvarine/.Trash Added sidebar item with name: Trash
Another option could be using Python to create a script with the PyPi package
finder-sidebar-editor and call it from the terminal.
Would be something like:
from finder_sidebar_editor import FinderSidebar sidebar = FinderSidebar() sidebar.add("/my/folder/path/")