How to stop creating .DS_Store on Mac? [closed] - macos

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm developing sites on mac and every time I create some folder (or file in that folder) .DS_Store is created in that folder.
How to prevent creating .DS_Store file ?

Please install http://asepsis.binaryage.com/ and then reboot your mac.
ASEPSIS redirect all .DS_Store on your mac to /usr/local/.dscage
After that, You could recursively delete all .DS_Store from your Mac.
find ~ -name ".DS_Store" -delete
or
find <your path> -name ".DS_Store" -delete
You should repeat procedure after each major Mac update.

NOTE: "Asepsis is no longer under active development and supported under OS X 10.11 (El Capitan) and later."
Here's a comprehensive review of your options. Asepsis (the second solution mentioned) seems to be what you're looking for, it re-routes .DS_Store creation to a unified cache instead of being located on every folder.

Its is possible by using mach_inject. Take a look at Death to .DS_Store
I found that overriding HFSPlusPropertyStore::FlushChanges() with a
function that simply did nothing, successfully prevented the creation
of .DS_Store files on both Snow Leopard and Lion.
DeathToDSStore source code
NOTE: On 10.11 you can not inject code into system apps.

Open Terminal. Execute this command:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Either restart the computer or log out and back in to the user account.
for more informations:
https://support.apple.com/en-us/HT208209

Put following line into your ".profile" file.
Open .profile file and copy this line
find ~/ -name '.DS_Store' -delete
When you open terminal window it will automatically delete your .DS_Store file for you.

this file starts to appear when you choose the system shows you the hidden files: $defaults write com.apple.finder AppleShowAllFiles TRUE
If you run this command disapear
$defaults write com.apple.finder AppleShowAllFiles FALSE
Use terminal

the function
find ~/ -name '.DS_Store' -delete
, removed the .DS store files temporarily. But am not sure , whether the files will came back on the Mac.
Also i noticed something peculiar, the "DS_Store" start coming to the Mac after installing 'ATOM'. So guys please make it sure to scan properly your third party software before installing them.
Best

If you want the .DS_Store files to become invisible (they still exist but can't be seen) then run the following command in the "Terminal" window:
defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder
This will set the system default to stop showing these files on your Desktop and elsewhere. It will also restart the Finder in order to make this change visible (especially on your Desktop).

Related

How do I stop MacOS updates from overwriting my auto_master file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
How do I stop MacOS updates from overwriting my auto_master file?
Every non-trivial MacOS update always removes my custom auto_master and puts in the default auto_master. I actually only add a single line to the end of the file and do not even modify the existing lines because they are irrelevant for me.
I have spent quite a bit of time figuring out automounts of NFS shares in OS X...
Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:
/etc/auto_master (see last line):
#
# Automounter master map
#
+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/- -static
/- auto_nfs -nobrowse,nosuid
/etc/auto_nfs (this is all one line):
/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
Make sure you:
sudo chmod 644 /etc/auto_nfs
Otherwise the automounter will not be able to read the config and fail with a ... parse_entry: getmapent for map failed... error in /var/log/messages
This will not work (anymore!) though it "should".
$ sudo automount -cv
...
automount: /Volumes/my_mount: mountpoint unavailable
Note that, if you manually create the mount point using mkdir, it will mount.
But, upon restart, OS X removes the mount point, and automounting will fail.
What's the solution?
It's so easy my jaw dropped when I figured it out.
Basically, we are tricking OS X into thinking we're mounting somewhere else.
When you're talking about paths in just about any environment, the root folder is the highest path you can reach, whether it's C:\ (windows) or / (*nix)
When you're at this path, attempting to reach the parent path, via .. will keep you at the root path.
For example: /../../../../ is still just /
By now, a few of you have already figured it out.
TL;DR / Solution:
Change your /etc/auto_nfs config from (this is all one line):
/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
For pre-Catalina: To (this is all one line)
/../Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
For Catalina and up: To (this is all one line)
/System/Volumes/Data/../Data/Volumes/my_mount -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://192.168.1.1:/exports/my_share
And re-run the automounter:
$ sudo automount -cv
...
automount: /Volumes/my_mount: mounted
..... there you go! Technically /../Volumes is still /Volumes, but the automounter does not see things that way ;)
This configuration persists the mount across restarts, and creates the mountpoint automatically.
Source github : https://gist.github.com/L422Y/8697518

How to change default directory in Bash for Windows 10? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
How can I change the default directory of windows bash to a folder of my choosing?
EDIT: I guess I should have been more clear. When I startup Bash I want it the directory to be in a location of my choosing like Desktop or something. How do I go about setting a default directory?
If you want change the directory your bash prompt is starting in, you can edit your .bashrc file. At the bottom, add:
cd ~
This will go into your home directory. (you can actually do just cd, but I it's clearer to add the ~ IMO)
To edit, you can use vim. If you don't know how to use it, you can always use nano for the time being, but you really should have a look at it, it's really powerful.
$ nano ~/.bashrc
This will open nano in "full console". At the bottom, you have the few commands you can use (^ means control) Do your changes, hit ctrl+o to save the file (write the file). It'll ask you where to write, by default, it's the right location, just hit enter and the .bashrc file will be saved. Then, you can press ctrl+x to exit.
Steps to set default directory for Bash on Ubuntu on Windows to a folder -
Open Bash on Ubuntu on Windows.
cd ~ to go to home directory of Ubuntu
Type edit .bashrc and enter at the Bash. This will open the file in vim.
Use Down Arrow or Page Down key on keyboard to go to the end of the file (there's a helpful progress bar at the bottom right corner of the Bash). At the end of this file, you will find cd ~, replace cd ~ with your desired location.
Save the .bashrc file. To save the file, click esc and then type :wq and click enter.
Note:
To access your hard disk location make sure you include the mount directory first.
So if want your Bash to open at C:\dev whenever you open the Bash. You need to replace the cd ~ with cd /mnt/c/dev at .bashrc file at Ubuntu home directory.
Just enter echo "cd ~" >> ~/.bashrc. This will append "cd ~" to your .bashrc.
.bashrc is executed everytime you start a(n interactive) bash instance.

please help me out with mac OS 10.11 terminal commands [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm new to using mac. Could someone please help me out with the terminal commands?
cd to jump into folders right?
i tried this but it isn't working for a folder in my desktop.
Basically, I want to enter a folder on my dekstop and then go to another folder inside that. how do i do it?
The Terminal starts in your HOME folder normally. So, type
ls
to list the files and you will see the same folders and files you see when you go to HOME in the Finder. So, you will see Desktop, so now type
cd Desktop
ls
and you will see all the folders and files on your desktop. If you want to go into one called Freddy Frog now, you will need to put double quotes around it to make sure the space between Freddy and Frog is kept and it doesn't think you want to go to a folder called Freddy then one called Frog. so type
cd "Freddy Frog"
ls
and you can now go to the "Spiders from Mars" directory in there with
cd "Spiders from Mars"
ls
In general, you can just start typing the name of the folder you mean and press TAB and it will guess what you mean. So, if you start a new Terminal and type:
ls
you will see the files in your Home directory. Now type:
cd Desk<TAB>
and it will show you what it guesses you mean. That's called filename completion. If you want to know where you are currently located, use:
pwd
which will print the working directory.
If you want to return to your HOME directory at any time, just type:
cd
Two other tips for you if you are learning your way around...
Firstly, if you want Finder to open and display the directory you are currently in in the Terminal, you can run:
open .
Secondly, when Finder opens, you can turn on the Path bar at the bottom of the window by typing:
Command+Option+P
I have shown it in red - no idea why Apple ships with it turned off by default - probably explains why most Mac users I have met generally have no idea where their files are and don't know the difference between copying and moving files!
To change directory to say /usr , the command should be cd /usr
i.e. cd followed by the absolute path of the directory. For relative paths use cd ./usr where the directory usr is in your current directory.This link gives complete documentation of cd command.
Use the change directory command:
using relative paths cd ./relative/path/to/directory
using absolute paths cd /absolute/path/to/directory
IMPORTANT: do not to forget the space after cd and before the path!!!!!
On Windows, the space isn't needed for some reason...

Shell rm rf directory under MacOS [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm developing sites on mac and every time I create some folder (or file in that folder) .DS_Store is created in that folder.
How to prevent creating .DS_Store file ?
Please install http://asepsis.binaryage.com/ and then reboot your mac.
ASEPSIS redirect all .DS_Store on your mac to /usr/local/.dscage
After that, You could recursively delete all .DS_Store from your Mac.
find ~ -name ".DS_Store" -delete
or
find <your path> -name ".DS_Store" -delete
You should repeat procedure after each major Mac update.
NOTE: "Asepsis is no longer under active development and supported under OS X 10.11 (El Capitan) and later."
Here's a comprehensive review of your options. Asepsis (the second solution mentioned) seems to be what you're looking for, it re-routes .DS_Store creation to a unified cache instead of being located on every folder.
Its is possible by using mach_inject. Take a look at Death to .DS_Store
I found that overriding HFSPlusPropertyStore::FlushChanges() with a
function that simply did nothing, successfully prevented the creation
of .DS_Store files on both Snow Leopard and Lion.
DeathToDSStore source code
NOTE: On 10.11 you can not inject code into system apps.
Open Terminal. Execute this command:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Either restart the computer or log out and back in to the user account.
for more informations:
https://support.apple.com/en-us/HT208209
Put following line into your ".profile" file.
Open .profile file and copy this line
find ~/ -name '.DS_Store' -delete
When you open terminal window it will automatically delete your .DS_Store file for you.
this file starts to appear when you choose the system shows you the hidden files: $defaults write com.apple.finder AppleShowAllFiles TRUE
If you run this command disapear
$defaults write com.apple.finder AppleShowAllFiles FALSE
Use terminal
the function
find ~/ -name '.DS_Store' -delete
, removed the .DS store files temporarily. But am not sure , whether the files will came back on the Mac.
Also i noticed something peculiar, the "DS_Store" start coming to the Mac after installing 'ATOM'. So guys please make it sure to scan properly your third party software before installing them.
Best
If you want the .DS_Store files to become invisible (they still exist but can't be seen) then run the following command in the "Terminal" window:
defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder
This will set the system default to stop showing these files on your Desktop and elsewhere. It will also restart the Finder in order to make this change visible (especially on your Desktop).

Find string within hidden file on OS X [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am trying to find text within one of bash's setup files on my mac (10.9.2).
I know the text "PIP_RESPECT" is in .bash_profile
I tried Find Any File, which apparently does not search within files.
I rebuilt my spotlight index.
I tried a finder search with visibility set to invisible, with no luck
I tried the following terminal commands:
mdfind "PIP_RESPECT"
mdfind *PIP_RESPECT*
mdfind "*PIP_RESPECT*"
mdfind '"*PIP_RESPECT*"'
which return nothing.
mdfind 'kMDItemTextContent == "*PIP_RESPECT*"cd'
which returns:
~/Library/Application Support/Firefox/Profiles/6wjt9c4s.default/sessionstore.js
which is clearly not the .bash_profile.
So what am I doing wrong?
Thank you for all your responses:
I am just trying to find the text "VIRTUALENVWRAPPER_PYTHON," if it exists, in any file, by any means.
I listed all the things I tried.
# stakolee:
$ grep 'PIP_RESPECT' ~/.bash_profile return in the terminal
returned:
~/.bash_profile:export PIP_RESPECT_VIRTUALENV=true
grep: return: No such file or directory
grep: in: No such file or directory
grep: the: No such file or directory
grep: terminal: No such file or directory
so the top return is what I want, thank you. I would give you a check mark, but it does not seem to allow check marks in comments.
#Mark Setchell
Easy Find finished a lot faster, but you have made me realize I need to learn more about grep.
I awarded the checkmark to:
# Thomas Tempelmann "find any file guy": sorry, I didn't mean to dis your app, but the Easy Find app did work, after i changed the settings to scan all files
I clearly have more to learn, thank you all, again.
I am not sure from your question if you are trying to say "How do I make Spotlight find a file?" or "I want to find a file containing PIP_RESPECT and I don't care how".
If the second, you can search through every file on your Mac from the terminal like this:
sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null
It will take some time to run! It says... starting at the root (top) of the filesystem, find everything that is a file (not directory) and look in every file (with grep) and see if you can find PIP_RESPECT and print the name of the file if you can and throw away error messages.
If you only want to search in your own login directory and below, it will be quicker and easier to do this (thanks to #I'L'I):
find ~ -type f -exec ....
Author of Find Any File here.
I tried Find Any File, which apparently does not search within files.
Right, it doesn't. But it documents that clearly both on the web page. May I quote:
Contrary to Spotlight, [...], but not for file content (use Spotlight or EasyFind for that).
And if you read a bit further down:
Alternatives to Find Any File
If you like to search for data inside files, and Spotlight doesn't do it for you, have a look at EasyFind by DEVONtechnologies [...]
If you want to search for specific text in a large set of files inside a directory, I recommend TextWrangler.
Also, the reason why Spotlight (including mdfind) doesn't find anything is that Spotlight implicitly ignores anything in the System folders. It won't ever find anything in there.
Hope that helps.

Resources