/tmp


#1

Heads up: This folder on my Mac running lion is not shown. I found the file in terminal, but spent a bit of time wondering why I wasn’t getting an error and not finding the file. I changed the folder to /Users/[My User]/tmp/cool.txt got the error and added the tmp to my user folder and then it worked.

I guess others got through this, so don’t know if it was unique to me.


#2

I can’t find this folder either.


#3

If you want to see the folder in Finder: use the Go->Go to Folder menu item.


#4

Not the only one, couldn’t find it either.
Had to come check the forums :slight_smile:

[quote=“BrianH”]Heads up: This folder on my Mac running lion is not shown. I found the file in terminal, but spent a bit of time wondering why I wasn’t getting an error and not finding the file. I changed the folder to /Users/[My User]/tmp/cool.txt got the error and added the tmp to my user folder and then it worked.

I guess others got through this, so don’t know if it was unique to me.[/quote]


#5

[quote=“tahakhan”]Not the only one, couldn’t find it either.
Had to come check the forums :slight_smile:

[quote=“BrianH”]Heads up: This folder on my Mac running lion is not shown. I found the file in terminal, but spent a bit of time wondering why I wasn’t getting an error and not finding the file. I changed the folder to /Users/[My User]/tmp/cool.txt got the error and added the tmp to my user folder and then it worked.

I guess others got through this, so don’t know if it was unique to me.[/quote][/quote]

Note too that Apple takes some pains to obfuscate temp these days for security. If you want to use the randomized per-user temp files you can get the base path with something like this:

NSString *userTempPath = NSTemporaryDirectory(); NSLog(@"Per-User temp is: %@",userTempPath);


#6

From Menu: Go, Go to Folder, type in
/Volumes/Macintosh HD/private/tmp
(replace Macintosh HD with the name of your hard drive)

alternatively,
in Terminal app,
$ cd …/… (move up two levels)
ls (to see list the directory)
cd tmp (to change the directoy)
open cool.txt

hope this helps


#7

[quote=“Brianpx”]From Menu: Go, Go to Folder, type in
/Volumes/Macintosh HD/private/tmp
(replace Macintosh HD with the name of your hard drive)

alternatively,
in Terminal app,
$ cd …/… (move up two levels)
ls (to see list the directory)
cd tmp (to change the directoy)
open cool.txt

hope this helps[/quote]

You can also just type /tmp into the Go box as well in the Finder. It will follow the POSIX synlink to the right place.


#8

Instead of using /tmp, there is a simple solution. Go to any document in your user documents folder and Get Info on that file. Use the path listed there instead in place of /tmp. For me, that path with Aaron’s text file at the end is: @"/Users/jbradleyhorn/Documents/cool.txt":


#9

//Thanks to you guys I’m finding the file on my system, but it’s empty. The file is being created, but for some reason the file doesn’t contain any of the text that the appendString method is supposed to be writing to str. //Figured this bit out {The next exercise also fails. The resolv.conf file is there, but I get an error: “read failed: (null)” .]

//But I still can’t get anything written into the file.

//Any ideas?

I finally found the bug. Tip: don’t write i = 10 when you really mean i = 0

(d’oh)


#10

[quote=“bikeboy”]//Thanks to you guys I’m finding the file on my system, but it’s empty. The file is being created, but for some reason the file doesn’t contain any of the text that the appendString method is supposed to be writing to str. //Figured this bit out {The next exercise also fails. The resolv.conf file is there, but I get an error: “read failed: (null)” .]

//But I still can’t get anything written into the file.

//Any ideas?

I finally found the bug. Tip: don’t write i = 10 when you really mean i = 0

(d’oh)[/quote]

As I am learning and writing more code - syntax errors (Like above) seem to become more common and causes me to read more carefully, lol.

Next time you have an issue - try posting the code here - another set of eyes will help spot the problem quicker.


#11

Finding the /tmp directory is covered in the book, but I too was wondering where to find “/tmp” after running the code. (I have two drives, and the code is on the external drive.)

Next version of this book should have have the little tidbit on finding /tmp earlier in the book! Perhaps even typing the code in.

Like: “This program uses the directory “/tmp” which is NOT easily found in the Finder utility. To get to /tmp, use the Go To Folder function of Finder… etc”

I spend a few minutes adding error code handling, changing directories written to, then gave up, and just continued reading the book, and voila…