Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

87

All drives (internal, external and networked) get mounted in /Volumes. You should see a folder there with the name of your USB drive as it appears on your desktop or in the Finder.


65

Shift-Command-G in Finder brings up a "Go to folder" dialog. Type in the name of the directory, for example, /usr/local. Finder will show the directory. I use this with Finder in 'View as Columns' While this doesn't give a browsable directory from the root directory down, I've found it quite useful.


48

Enter in Terminal: sudo chflags nohidden directoryname Whereby directory name is the name of the directory that you want to see in Finder. Reverse this by typing: sudo chflags hidden directoryname The Macintosh HD basically resembles the root directory. If you want it to appear on the desktop and in finder change this in the finder preferences. ...


48

Is there a manual or guide to what all of the built-in directories should be used for? Like what is /home/, or /net/? Take a look at the File System Programming Guide for the most up-to-date information and at man hier in Terminal, which provides a "historical sketch" of the filesystem hierarchy (it's included at the end of this answer for reference). A ...


36

As you've noticed, recent versions of OS X only display generic folder icons in the sidebar. So why does Dropbox get special treatment? The short answer is that Dropbox uses undocumented API to accomplish this. In non-technical speak, it's a special hack that's installed by the Dropbox application. Some curious folks on StackOverflow found the specific ...


25

autocd was added in bash 4.0. You can install a newer version of bash with Homebrew and then change the default login shell with chsh: brew install bash;echo /usr/local/bin/bash|sudo tee -a /etc/shells;chsh -s /usr/local/bin/bash After you open a new login shell (or a tab by default in Terminal or iTerm 2), echo $BASH_VERSION should print something like 4....


23

You can use zip command in Terminal to zip the files without the .DS_Store, __MACOSX and other .* files. Open Terminal (search for terminal in spotlight) Navigate to the folder you want to zip using the cd command Paste this zip -r dir.zip . -x ".*" -x "__MACOSX" Example: Let's say you have a folder on your desktop called Folder with stuff to zip. Open ...


22

It's a bit messy, and there is a degree of cross-overs, but the quick tour, without really going into the subfolders of these: /etc, /tmp and /var are just symbolic links to subfolders in /private. /etc generally contains configuration files. /tmp is for temporary files used by running processes (also see /var/tmp) /var is also used for somewhat ...


21

This is a classic use case for rsync: rsync -av /source-path/source-dir /destination-path rsync will copy only new and changed files to the new location. It is important to understand how a trailing slash on the source argument functions. If there is a trailing slash then the contents of /source-path/source-dir will be copied to destination-path. If ...


20

Some techniques to try: ls -a /Volumes or... ls -l /Volumes or... ls -la /Volumes ...may prove useful. mount seems to give all the partitions that might be useful with Disk Utility, during formatting, etc. you can probably reach your USB drive directly using: /Volumes/<NameOfYourDrive> This applies to other types of drives as well: optical,...


20

This should just work: cd /path/to/-folderthatstartswithdash EDIT: According to this question, this works if you only want to input the name: cd -- -folderthatstartswithdash


19

cd ./-folder usually works quite well here (and also with other commands)


18

Any person new to Apple and Mac would find lot of things un-intuitive or just forced on the user, w/o any options to change it. Or it might be that just many of us had their first experiences on Win/Linux systems. But just found this plugin to finder XtraFinder which among lot of other options allows you to ENTER/RETURN to open a file. Feeling a lot ...


17

With the assistance of AppleScript you can accomplish this. Open AppleScript Editor, create a new document and paste the following stolen lines: tell application "Finder" try if exists Finder window 1 then set thisPath to (the target of the front window) as alias else set thisPath to (path to desktop) end ...


16

Get Info on the folder. Click the icon on the top-left of the window. Press ⌘X or Backspace Alternatively, cd into the directory and run rm Icon$'\r' To delete the icon from multiple folders at the same time, run the following command: find ~/Desktop -name Icon$'\r' -delete Replace ~/Desktop with the containing folder of the folders that you wish to ...


15

If you hold option the (+) button to add a search criteria will become a (…) and an Any/All/None block. Set this to None. For the criteria select Document Container. It won't be in the default list alongside Name, Kind, etc. Select Other… to select it from a list of additional criteria so long it has its own search feature: Set this to the name of the ...


14

From this SO answer: Backup your old default Desktop folder If you have files in your existing Desktop folder, don’t worry. We’re going to back up your existing folder so you can copy your old Desktop files to your new DropBox Desktop folder afterwards. Simply open a terminal and enter the following command. sudo mv desktop desktop.bak ...


13

Hallelujah! I figured it out. Okay, so first thing I did was create a new account, as suggested by another answer. The problem did not occur in there, so clearly the problem was limited to my account. I then went into Safe Mode into my account. The problem did not occur as well. So clearly something was loaded in normal mode but not in safe mode that was ...


12

Art, Do you have this working successfully? Have you tried hiding the folders using something like: chflags hidden ~/Documents Then creating a link to it such as (in Terminal): cd ~ mkdir stuff cd stuff ln -s ~/Documents I believe that this will hide the ~/Documents folder from the Finder but it will still be there so anything writing to it will work ...


12

/home is used as a mount point for the automounter (see /etc/auto_master and /etc/auto_home), you can't create your own directories in there. If you are looking for a place to store common administrator stuff shared between different administrators, create a directory in either /Users/(any admin account) or /usr/local/share and make it accessible to all ...


12

Experts recommend that you should set up the minimal hierarchical folder structure that is logical for you, and use tags for all other categories. For example, Kerry Gleeson's classic book The Personal Efficiency Program (1994, 4th edition 2009) recommends the following three folders: 1. Working, 2. Reference, 3. Archives. "Working" would contain files ...


12

I filed a bug report with Apple and this seems to finally be fixed now in Mojave 10.14.4 (18E226). To fix, update your OS to the latest version. Then reboot into recovery (CMD-R) and run disk first aid. It should show one or more error: directory valence check: directory (oid 0x123456): nchildren (1) does not match drec count (0) and / or error: ...


11

Terminal command to change screenshot save location: defaults write com.apple.screencapture location "/path/to/new/location" Put your desired screenshot path between the double quotes as it is required if any spaces exist in the location path! Locations without a space will still be executed properly. Example path with a space in new path: defaults ...


10

According to the documentation for the Finder Sync Extension: You can also use the extension point’s API to add a toolbar button to the Finder window or a sidebar icon for the monitored folder. I would guess this is what Dropbox uses to achieve this and some/all the other functionality facilitated by this extension. For example you can also: ...


10

There's a CLI tag tool available via Macports/Homebrew: https://github.com/jdberry/tag It doesn't seem to have a recursion option, however, I would imagine you could use this in conjunction with the standard UNIX 'find'. e.g., (from inside the directory you want to tag files in) find . -exec tag --add tagname {} \; -print


10

I had the same issue with an account folder, which I restored from a backup via rsync. The problem seemed to be the corrupt or missing creation date. After setting it manually the folder was acting normal again. I used the SetFile command from XCode's command line tools. So this should solve the issue: SetFile -d '12/31/1999 23:59:59' will-not-open


9

In general, to find where something is mounted, you can run this command from the terminal: df -H This also provides useful information about the space on the drive.


9

There are many web pages that will walk you through this process, here is a good one: http://www.maclife.com/article/howtos/how_move_your_documents_folder Basically you create a symbolic link to a folder on an external drive. Here is information on how to use the console to create a symbolic link: http://hints.macworld.com/article.php?story=...


9

In bash, there are two main ways to have spaces in path names: Backslash escape the spaces /path/to/folder\ with\ spaces/ Wrap with quote marks "/path/to/folder with spaces and $variable/" '/path/to/folder with spaces and a literal $/' Double quote marks expand shell variables. Single quote marks do not.


9

Just some extra information ... My understanding is that __MACOSX is a subdirectory artificially created by the Mac GUI tools to hold meta data such as extended attributes that can't be normally saved in a zip file. If you use the Mac GUI tools to unpack the zip file, then the tools will know what to do with __MACOSX and the directory won't actually get ...


Only top voted, non community-wiki answers of a minimum length are eligible