# Save .txt file to desktop Mac

**URL:** <https://discourse.processing.org/t/save-txt-file-to-desktop-mac/17750>\
**Category:** Coding Questions\
**Created:** [February 11, 2020, 8:15pm UTC](https://discourse.processing.org/t/save-txt-file-to-desktop-mac/17750 "2020-02-11T20:15:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdotjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sdotjo/32/5639_2.png) [@sdotjo](https://discourse.processing.org/u/sdotjo)\
**Post date:** [February 11, 2020, 8:15pm UTC](https://discourse.processing.org/t/save-txt-file-to-desktop-mac/17750/1 "2020-02-11T20:15:54Z")

</div>

Hi all,

I want to save the .txt file my processing sketch outputs directly to a mac desktop. Can you suggest how I’d do that? I assume it’s within createWriter(), but I don’t know how to signify a path on mac. Here’s my sketch:

```auto
PrintWriter output;

int count = 0;
int x = 0;
int y = 0;
int i=0;
int timer = 0;
float m;

ArrayList xp = new ArrayList();
ArrayList yp = new ArrayList();

void setup(){
  output = createWriter("coordinates.txt");
  size(400,400, P3D); 
  background(0);  
  noFill();
  stroke(255);
  strokeWeight(1);
  
}

void draw(){
  background(0);
  
  int sx,ex,sy,ey;
  float z = 0;
  xp.add(mouseX);
  yp.add(mouseY); 
  if(xp.size() > 1){
    for(int i = xp.size()-1 ; i > 0 ; i--){
  sx = (Integer) xp.get(i);
  ex = (Integer) xp.get(i-1);
  sy = (Integer) yp.get(i);
  ey = (Integer) yp.get(i-1);
  line(sx,sy,z,ex,ey,z-1);
  z -= -.1;
}
 
// output.println ("x=" + mouseX);
// output.println ("y=" + mouseY);
// output.println ("z=" + z);
  } 
  output.println(mouseX+","+mouseY+","+z);
}

void keyPressed(){ 
    output.flush();
    output.close();
    exit();
}

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [February 17, 2020, 12:50am UTC](https://discourse.processing.org/t/save-txt-file-to-desktop-mac/17750/2 "2020-02-17T00:50:46Z")

</div>

> [@sdotjo](#):
>
> I don’t know how to signify a path on mac

On your Mac, open Terminal.

```auto
> cd Desktop
> pwd
/Users/jeremydouglass/Desktop
> touch afile.txt

```

Now there is a file at:

```auto
/Users/jeremydouglass/Desktop/afile.txt

```
