Can I gedit something in Mac's Terminal [closed]
Asked Answered
L

4

14

When I was using a Linux laptop as my dev machine, I used to do "gedit xxxx" in a Terminal. Now I just switched to MacBook, I d like to do the same thing.

I know that I can open gedit in a command line like "open gedit", but can I add the file name? Otherwise I have to use vim. I am not a fan of vim.

Lyda answered 26/1, 2012 at 1:24 Comment(1)
not a fan of vim!? blashpemy!Unconcern
P
11

Add

alias gedit="open -a gedit"

to ~/.bash_profile :

Now you'll be able to gedit directly from the command line.

Photocurrent answered 6/12, 2012 at 4:21 Comment(1)
Not exactly the same, because in Linux you can do gedit nonexisting_file, whereas Mac's open will say file does not exist.Kondon
Q
5

try:

open -a /path/to/gedit /path/to/file.txt
Quantify answered 26/1, 2012 at 1:28 Comment(1)
just perfect... this should be way upFarcy
G
2

I added the following to my PATH:

:~/Applications/gedit.app/Contents/MacOS/

and afterwards I was able to access gedit from the command line. One caveat: if gedit is not already running on the system, then it throws an error if I launch it from the command line. Once gedit is already running though, this works to open files in gedit from the command line.

To edit the path, open ~/.profile in an editor

Greer answered 26/1, 2012 at 1:28 Comment(0)
C
0

I use textmate for dev, here is a tutorial how it is done for Textmate

http://manual.macromates.com/en/using_textmate_from_terminal.html

I believe the same would apply to gedit.

Hope it helps

Chockablock answered 26/1, 2012 at 1:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.