By default it is not possible to see .gitignore files in osx. What is command to reveal these files?
Open the terminal and type
on OS X 10.8:
defaults write com.apple.Finder AppleShowAllFiles TRUE
on OS X 10.9:
defaults write com.apple.finder AppleShowAllFiles TRUE
Then you must relaunch finder:
killall Finder
Any file name in OS X prefixed with a '.' is considered "hidden".
You can use the shortcut in Finder:
Command + Shift + .
It will show the hidden files.
To hide the files again, use the same shortcut.
⌘⇧. will toggle the AppleShowAllFiles setting.
This key combo will work from open/save dialogue boxes in all apps, not just the finder. Use this and you’ll never be confused when on someone else’s Mac or a new Mac, and you can avoid mucking around with defaults write.
I use the nemonic of “use a dot to show a dot file” to remember it, because of hidden dot files in unix.
if you just want to look at them you can always use the command line:
ls -al path/to/dir
If you want to always view all files from the finder you can do:
defaults write com.apple.Finder AppleShowAllFiles YES
If you just want to view a .gitignore from the finder you can:
chflags nohidden /path/to/dir/.gitignore
But youll have to call that command on every .gitignore its not global.
(more recent, for 10.10.2:)
The above commands didn't work for me. I'm using OSX Yosemite: 10.10.2.
This worked though:
defaults write com.apple.finder AppleShowAllFiles -boolean true;
killall Finder;
Source:
http://www.idownloadblog.com/2014/08/04/how-to-show-hidden-files-folders-finder-mac/
You can edit hidden file in terminal using this command
open -a TextEdit .gitignore
If you just want to view a .gitignore from the console just type "nano .gitignore" in that directory. This command "nano" simply opens any textfile in nano console environment for viewing or editing
In addition to the accepted answer, you can create an alias to easily show/hide the hidden files in Terminal. This is how I set it up (tested/working on macOS Mojave 10.14.1).
In my user directory I created a new file .custom_aliases and wrote this in:
# Show/hide files
alias showall='defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder'
alias hideall='defaults write com.apple.finder AppleShowAllFiles -boolean false; killall Finder'
Next I opened .bash-profile (should also be in your user directory, if not just create it there) and added this to the top of the file:
# Load custom aliases
source ~/.custom_aliases
And that's it! Now whenever I need to view the hidden files I just type showall in Terminal and hideall when I'm done. You could also define the aliases directly in the .bash_profile, but I have some other stuff so I like to keep all the aliases together in a separate file.
Show hide file and folder on MacOs Mojave 10.14.4
Apply at Terminal
defaults write com.apple.finder AppleShowAllFiles -boolean true;
killall Finder;
It's possible you might just not have a .gitignore file. If you don't have one, you can create it like this:
>touch ~/.gitignore
And then edit it however you'd like. Git will automatically check this file, without any additional configuration!
Related
I have folders and files on the desktop, I would like to make sure that when I take a screenshot or video recording of a program, the folders and files I have on the desktop are not seen.
Is there any command on the terminal that allows me to do this?
I need to hide everything only when I do the screen or the recording, and then return everything as before.
How can I do?
defaults write com.apple.finder CreateDesktop false && killall Finder
will hide all Files and Mounts, with
defaults write com.apple.finder CreateDesktop true && killall Finder
you can display them.
You have to invoke the commands from terminal
Tested wit Monterey 12.3
I already have finder showing hidden files by using
defaults write com.apple.finder AppleShowAllFiles YES
However, sublime text will not allow me to open hidden files still.
I'm looking for a programmatic way to accomplish this. So that I don't have to type a special key combination for each dialog.
Press "Command" + "Shift" + "." (dot) to show hidden files in the Mac OSX file chooser dialog.
You can also modify the folder_exclude_patterns setting. The default value for this is "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"]. In your case, you would want to make it "folder_exclude_patterns": [".svn", ".hg", "CVS"] You can access user settings by going to Preferences -> Settings - User
The defaults write command you entered only sets AppleShowAllFiles to true (or YES, they're equivalent) for Finder. To enable showing hidden files in all programs, enter
defaults write -g AppleShowAllFiles YES
The -g flag means "global", setting the AppleShowAllFiles attribute to true for all programs.
You'll have to restart Sublime after entering this command.
Why doesn’t my Laravel project show the .env file on a Mac?
How to fix it?
If you would like to see hidden file in Finder just press CMD + SHIFT + .
you'r not showing hidden files
Open Terminal found in Finder > Applications > Utilities
In Terminal, paste the following: defaults write com.apple.finder
AppleShowAllFiles YES
Press return
Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock
and click Relaunch.
This will show all hidden files
here you can find how to show them on mac
I need to open files in Xcode in the /usr but its invisible.
I already tried
defaults write com.apple.finder AppleShowAllFiles YES.
and restarted my finder but that didn't seem to work.
What should I do?
In the open file dialog box, you can hit Command-Shift-G and enter /usr in the Go To sheet.
In Windows I would create a .bat file to run this script from my desktop, on my Mac how do I create something similar that can be run from the desktop to execute this:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Create a file with the following content
#!/bin/bash
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
From the terminal.app, run chmod o+x <filename> to make the file executable.
To run the file simply open the terminal.app and ./<filename>
Name the file .command or .sh.
Shoan's instructions for making a shell script will work fine, but you need to run it from within Terminal. If you add jtbandes suggestion of giving the filename a .command suffix (.sh doesn't work for me) the file becomes double-clickable in the Finder -- but it still opens a Terminal window, and leaves it open when it finishes. If you don't want to be bothered with this, there are a couple of ways of doing the job without any extraneous UI stuff:
1- Create an AppleScript in the AppleScript Editor (which is either /Applications/Utilities/AppleScript Editor.app or /Applications/AppleScript/Script Editor.app, depending on which version of OS X you have). Enter this as your script:
do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder"
... and then save the script in Application format so it's double-clickable (if you save it as a "Script", double-clicking it will open the script editor instead).
2- Create an Automator workflow using /Applications/Automator. Use the Application template (again, to make it double-clickable), find the "Run Shell Script" action in the second column (it's a huge list, so I just type "shell" in the search field at the top) and drag it into the workflow space at the right. Make sure it's set to use a reasonable shell, paste in your commands, and save.
I used to use batch files but the pain was having to find the folder where the scripts where kept. This became a pain so now I use alias's which work from any location in terminal and do not require finding your script.
Of course you can use these together nicely.
To get started you need to access your bash_profile.
A bash profile is an invisible file that lives on your machine, I believe it is homeless without a particular location.
So how do you find it?
Well it either exists or it does not, so to access the file simply write:
sudo nano ~/.bash_profile
This command will either create it or open it up
Once inside, add the following lines:
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
Thats it...
ctrl + O to save
ctrl + X to exit
And finally refresh the bash profile:
source ~/.bash_profile
How do you use the commands? Well now to show files, simply write: showFiles and to hide files just write: hideFiles... voila!
I use this to make life easier while using terminal. For instance to ssh to websites, or open help files, or to access mysql etc. etc.
Here are some further uses you may find useful:
alias goWebsite='open http://www,google.com'
alias goDoc='open -a TextEdit /users/myusername/documents/mydocument.txt'
alias goLocation='cd /applications/mamp/htdocs/workspaces/general/website.com/trunk'
alias sshToServer='ssh user#mysite.sitename.com'
Now all you need to do is type the alias from terminal and the command will execute.
Hope you find the above useful