Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing the location temporary files in STATA on MAC

    Hi,
    I am running a do-file which creates various large temporary files. And because of that my laptop runs out of the memory. I have attached a hard drive to it. I don't know how to change the directory of temporary files to be saving them in the hard drive. Can you advise? I am working on a MAC. I have tried setenv command but it doesn't work- Stata cannot find it. Many thanks for your suggestions in advance!

    Ciara

  • #2
    I want to start by clarifying the problem. When you say your laptop runs out of memory, do you mean it runs out of internal memory, or it runs out of disk space on your internal drive? What is the error message you get? Was it "insufficient disk space"?

    If indeed the problem is with insufficient space on your internal drive, so that the external drive is perhaps the solution, then here is the approach you want.
    1. Exit from Stata.
    2. Launch the Terminal application (it's in the Utilities folder in the Applications directory and in the Other box in Command Center).
    3. In the window that opens, I am hoping you see as a prompt the second line copied below - at least, it should start with "bash", the version number is unimportant. If not, type the "bash" command, as I did, and you will then see the bash prompt that is needed.
      Code:
      	lisowskiw 1% bash
      	bash-3.2$
    4. Type the commands shown below, substituting the name of your hard drive for the name I used.
      Code:
      	bash-3.2$ export STATATMP="/Volumes/ExternalHD"
      	bash-3.2$ open /Applications/Stata/StataSE.app/
    5. Stata will open. In the Stata command window, type the following command and review the output to confirm that the temporary directory is set to the path to your hard drive.
      Code:
      	. display c(tmpdir)
      	/Volumes/ExternalHD
    6. When you quit Stata, return to the Terminal window and type "exit", then quit the Terminal application.
    This updates instructions I gave in earlier topics at
    https://www.statalist.org/forums/for...on-on-mac-os-x
    and at
    https://www.statalist.org/forums/for...ation-mac-os-x

    Please report if this works and if so I will update those two topics to point to these improved instructions.
    Last edited by William Lisowski; 05 Dec 2018, 11:34.

    Comment


    • #3
      Thanks William for your response. I have attached a screenshot below where you can see how my terminal looks like. I typed the commands you mentioned and it gives me errors (also see attached the screenshot). I tried with the links you gave, with setenv command, but still doesn't seem to work. Could you suggest what to do?
      Thanks,
      Ciara
      Attached Files

      Comment


      • #4
        The problem is that every user's system is a little different - your Terminal window doesn't look like mine, and it doesn't look like the one in the Guest account on my Mac. So I'll update the instructions below. But please, can you respond to the question in the first paragraph of my post #2 above about the error message you get when you "run out of memory"?

        In what follows, what you type is shown in red and what the Terminal or Stata types is shown in black.
        1. Exit from Stata.
        2. Launch the Terminal application (it's in the Utilities folder in the Applications directory and in the Other box in Command Center).
        3. In the Terminal window that opens, the title bar at the top of the window should include something like "-bash" to indicate that the bash shell is running. If not, type the command "bash" as shown below. Don't worry if the prompt that Terminal responds with doesn't match the one shown below.
          Code:
          lisowskiw 1% bash
          bash-3.2$
        4. Type the commands shown below, substituting the name of your hard drive for ExternalHD, which was the name I used for mine.
          Code:
          bash-3.2$ export STATATMP="/Volumes/ExternalHD"
          bash-3.2$ open /Applications/Stata/StataSE.app/
        5. Stata will open. In the Stata command window, type the following command and review the output to confirm that the temporary directory is set to the path to your hard drive that you specified on the bash export command.
          Code:
          . display c(tmpdir)
          /Volumes/ExternalHD
        6. When you quit Stata, return to the Terminal window and either re-launch Stata by typing the "open" command given above, or else quit the Terminal application, clicking "Terminate" if a confirmation dialog box appears.
        Last edited by William Lisowski; 05 Dec 2018, 17:38.

        Comment


        • #5
          Thank you very much, William, that worked! The problem was that the storage space of the MAC was not enough and I have attached a hard drive which has solved the problems.
          Regards,
          Gayane

          Comment


          • #6
            Hi again William,
            Now my temporary files are saved in the HDD but still my storage on MAC decreases : please see the Macintosh HD which decreases continuously and I am afraid Stata will stop again. Could you tell me please what is the problem? I have attached the screenshot below. Thanks!
            Attached Files

            Comment


            • #7
              In the window on the right, which was opened when you selected your internal disk "Machintosh HD" and chose "Manage Storage" from the contextual menu, you have selected the category "Applications" which uses only 23GB of your disk. You should instead select the category "Documents" which currently use 177GB of disk - 70% of your disk! - and look at what has been created recently to understand why your free space continues to decrease, and look for large files that are not needed and can be deleted. I suspect your Stata programs continue to create large files in the "working directory", and if those files are needed, you may want to create a directory in your external hard drive and use it to save your "permanent" datasets.

              I note that you have 2.5GB in your trash, so you may want to start by emptying the trash.

              Comment


              • #8
                thanks William, I didn't really select the Applications, was just checking the storage space overall, it automatically pointed on it just randomly- I got your point but my working directory on Stata is the HDD so all the files generated there are saved on HDD. But thanks for that, I will keep an eye not the Documents folder to make sure I see what documents are created that take my space.

                Comment


                • #9
                  An improved version of the advice in post #4 has been posted at

                  https://www.statalist.org/forums/for...nment-variable

                  Ciara, the new post isn't relevant to our current discussion -- this notice is just in case someone later reads this topic looking for help with the same problem you had, the can see a more considered explanation than the one I gave here.

                  Comment

                  Working...
                  X