# Cannot find BaseDirectory or UserBaseDirectory in Mac OS El Capitan

I am new to Mac OS, so this might be a silly question, but....

I just searched for $BaseDirectory and $UserBaseDirectory in my Mac OS El Captain, using the Finder. Neither directory is present apparently. For example, searching for

/Users/Alessandro/Library/Mathematica

I cannot find the Library directory. Similar problem with

/Library/Mathematica

I can find the Library directory, but there is no Mathematica directory inside.

In Windows, the analogous directories are hidden. Is this the same in Mac OS too? If yes, how can I see them?

• Don't know about Mac OS but what about SystemOpen @ $UserBaseDirectory? – Kuba Mar 7 '16 at 20:26 • They are hidden. You can tell Finder to show hidden files and folders by entering a specific command in the Terminal: defaults write com.apple.finder AppleShowAllFiles YES and then relaunch the Finder. You can also use Mathematica's SystemOpen command to access them, as @Kuba suggested. – Stefan R Mar 7 '16 at 20:47 • The directories you mention are not on in the usual places for $UserBaseDirectory and $BaseDirectory OS X. Did you do some kind of custom install? For instance, $BaseDirectory is usually /Library/Mathematica and this directory is not hidden in Yosemite. (I have not upgraded to El Capitan. – m_goldberg Mar 8 '16 at 0:26
• @m_goldberg No custom install, I edited the paths and their status. I ultimately solved the problem following Kuba advice. But I first tried Stefan's trick (also found online): /Users/Alessandro/Library becomes visible but cannot be opened, while /Library/Mathematica simply does not exist. All in all the only reasonable solution seems to be Koba's SystemOpen one. All this is not easily found in the documentation. I am a bit disappointed by WRI. What is the point in making these important directories so hard to reach? – magma Mar 8 '16 at 9:44
• @magma As was already mentioned, these libraries (/Library/ or /Users/.../Library )are by default hidden in OSX. Try to google "show library in finder". This question is not mathematica related. – SquareOne Mar 8 '16 at 9:51

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: • Great answer! Thanks – magma Mar 10 '16 at 2:35 • This is useful code – user6014 Jan 5 '18 at 22:50 • @user6014 I'm glad it helps :) – Kuba Jan 6 '18 at 11:34 • @Kuba: This may not work properly in upcoming Mathematica releases. (That a version 12 is on the way is no secret: In his frequent Twitch live-streaming "CEOing", he repeatedly refers to version 12.) Can you PM me to discuss this, since it's inappropriate to publicly deal with it right now? You'll find my email address at my web page math.umass.edu/directory/emeritus-faculty/murray-eisenberg. – murray Nov 14 '18 at 1:20 • @murray it's 4 am here so I will contact you as soon as I hit the office later in the morning. – Kuba Nov 14 '18 at 2:45 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. • Good things to know, thanks – magma Mar 10 '16 at 2:33 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.

• I have the same problem. I cannot see (nor via SystemOpen access) \$BaseDirectory (/Library/Mathematica), even though I can see hidden folders in Finder. MacOS Sierra 10.12.6, Mathematica 11.2.0. – CarbonFlambe Sep 24 '17 at 9:11