Cannot find BaseDirectory or UserBaseDirectory in Mac OS El Capitan

Ok, so the quick way to find given directory is just to use SystemOpen @ dir. E.g.

 SystemOpen @ $UserBaseDirectory

I go there all the time so I added a menu to the main menu in order to not write this each time. Here's the procedure:

   (*aux function*)
dir = FileNameJoin[{ #, "SystemFiles", "FrontEnd", "TextResources",
    $OperatingSystem /. "MacOSX" -> "Macintosh"}] &;

   (*we are going to play inside $UserBaseDirectory to not break installation*)
   (*not everything from $ID is present in $USB so let's create that directory and file if that's necessary*)
If[Not @ DirectoryQ @ #, 
  CreateDirectory[#, CreateIntermediateDirectories -> True]
] & @ dir @ $UserBaseDirectory;

CopyFile[
  FileNameJoin[{dir@$InstallationDirectory, "MenuSetup.tr"}],
  FileNameJoin[{dir@$UserBaseDirectory, "MenuSetup.tr"}]
];

SystemOpen @ FileNameJoin[{dir@$UserBaseDirectory, "MenuSetup.tr"}]

Now you have to add the menu anywhere you find it handy:

Menu["Locations", 
    {

        MenuItem["$UserBaseDirectory", KernelExecute[ 
          SystemOpen[ $UserBaseDirectory] ], MenuEvaluator -> "System" ],
        MenuItem["$InstallationDirectory", KernelExecute[ 
         SystemOpen[ $InstallationDirectory] ], MenuEvaluator -> "System" ],
        MenuItem["$TemporaryDirectory", KernelExecute[ 
         SystemOpen[ $TemporaryDirectory] ], MenuEvaluator -> "System" ],
        MenuItem["NotebookDirectory[]",  KernelExecute[  
            If[
                ReplaceAll["FileName", NotebookInformation[SelectedNotebook[]]] =!=  "FileName", 
                SystemOpen[ NotebookDirectory[ SelectedNotebook[] ] ]
            ]], 
            MenuEvaluator -> "System"
        ]

    }],

Don't miss any comma etc. Save, restart MMA and be happy:

enter image description here


On OS X, ~/Library is hidden by default (despite its name not starting with .). You can open it by clicking Go in the menu bar (Finder), then holding down the Option key. As soon as you press Option, Library appears in the list of locations you can "go to".

You can also hit Command-Shift-G in the Finder then type the path manually (or with Tab-completion) and hit Return. The location will be opened in the Finder even if it is hidden.


In neither Wolfram Desktop nor Mathematica Home Edition does $BaseDirectory reference a directory/folder that exists on El Capitan.

Mathematica references /Library/Mathematica Wolfram Desktop references /Library/Wolfram Desktop

I am not sure, yet perhaps this is a defect caused by a missing tilde '~' which would you would expect to be expanded to reference the User domain aka ~/Library/Mathematica expanding to "/Users/foo/Library/Mathematica".

The short solution is to substitute $UserBaseDirectory in place of $BaseDirectory or, perhaps to reference the Application package itself /Applications/Mathematica.app/Contents/SystemFiles

I ran into the same problem while trying to figure out why my importer for Apple Mail emlx files must be explicitly referenced while calling Import rather than automatically loading as the documentation says it should.

EDIT: My answer concerns version 11. I have yet to verify that this case exists on 9 or 10

EDIT: Contrary to what others indicate, this is not an OS X issue. Mathematica 11 Home and Wolfram Desktop 11 references a Folder that does not exist, so clearing the 'hidden' attribute does nothing.