Edit sqlite file from terminal Mac - macos

I can not find any documents where I can open existing sqlite database file that I made from the terminal on Mac. I want to add some additional rows to the existing database. I probably search for the wrong things, so anything that points me in the right direction is much appriciated.

If you want to remain in the Terminal, you can open a sqlite3 database using the command sqlite3 [databasename]. From here, you can select rows or insert new ones using SQL commands. If you prefer a GUI, there are many to choose from, including the free Firefox plugin, sqlite-manager.

Whenever you work with Mac built-in sqlite3 it saves the files in the current folder where your Terminal is and the way you can access them is the reversed story, open sqlite3 while you are at the folder where your database is.

Find and get precompiled binaries for OSX.
Use the command line client.

I realize this is a bit tangential to the question, but it's helpful to be able to find/move hidden files in Finder, because often sqlite DBs will wind up in a hidden folder. See:
http://www.macworld.com/article/1051830/showallfinder.html
The key bit is to enter this in the Terminal, then force Finder to relaunch (via the Apple menu's Force Quit on Lion):
defaults write com.apple.Finder AppleShowAllFiles YES
Change that to NO at the end to toggle it off.

Related

Clear Recent items in Preview Application of Mac OS X..?

Hello all,
Can anyone tell me how to clear the 'Recent items' list in Preview application of Mac OS X through code? Is there a terminal command that can do this?
Or is there any way to click on 'Clear Menu' in 'Open Recent' of the 'File' menu in Preview?
Alternatively, does someone know where Preview stores this information and how do to remove it?
Check out this image to see what I mean.
Ok, so none of the described methods on the websites I could find actually succeeded in getting rid of all the 'recent document' lists in all of my apps.
I feel the most common sense approach would be (for OSX 10.12 / Sierra):
First go to system settings > general and choose "none" in the recent file dropdown menu (my OSX is in another language so the exact terms might be different, but you should be able to see what I mean). / This will get rid of most, but not all recent-items in different apps.
Get familiar with Apple's 'defaults' command in terminal. Now, hunt for any lists you might still want to get rid off, e.g. none of the options mentioned in the answers already listed here helped to get rid of the recent-items list in Finders "GO" menu. I played around with the defaults command and found that: "write com.apple.finder "FXRecentFolders" '({})' && killall Finder" does the trick for me. Playing around I found similar solutions for many of the other apps that where still able to maintain a list of recent items.
Create a shell script containing the commands you found during step 2.
Schedule the script to be run automatically on a preset interval or action (e.g. log out). AND/OR create an alias in your shell's profile (or directly apply the script as a function inside it) so you can call it with a single command from your terminal. (for instance: I have created an alias to it, so when I now type "killrecent" in terminal, it empties all the recent-items lists I've been able to find.
Hope this will be of some help to others. Good luck!
open Preview ->- go to File ->- Open Recent ->- Clear Menu
You may try the approach outlined here, which is to run
defaults delete com.apple.Preview.LSSharedFileList RecentDocuments
in the Terminal (manually or through your app). However I tried this and it didn't work for me (OSX 10.11), since the Preview defaults file doesn't contain this entry.
You can use
defaults write com.apple.Preview NSRecentDocumentsLimit 0
which will hide all recently used items, but as soon as you set that number to anything greater than 0, they will show up again.
I also checked the ScriptingBridge Interface for Preview, but couldn't find anything useful. So unfortunately it looks like this is not possible.
with 10.11, there are at
~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.preview.sfl

OSX 10.10 Terminal. Help Needed

Dumb question in my terminal I make documents using the touch command. For example:
touch blah.pages
touch blah.numbers
The file was created, but I cant open it.
I'm curious as to why this is. Please help me!
You're probably using Pages and Numbers respectively to open these files, since that's the default.
These programs can't open Pages or Numbers files not created within them, for whatever reason.
You can open the files in another editor though, like nano for example.
Try nano blah.pages and you can edit the empty file.

How to make application autorun on Mac?

I want to make my application autorun, like using autorun.inf on Windows. I googled and there is one way for me to do that:
"On the Mac side there are many applications you can buy for creating a Finder window that looks a certain way but all these changes can be made within finder. You then will need to copy the DS_Store file to the CD and finder will automatically apply any changes that you have made.
Also using -hfs-openfolder will cause it to open automatically when inserted on the mac."
Can anyone tell me more clearly about that, or is there any other way?
Thanks so much.
According to this page, you should be able to do that with bless:
sudo bless --folder "/Volumes/discName" --openfolder "/Volumes/discName"
The man page confirms that, at least on 10.6.8. I don't have Lion in front of me right now.

How do I make certain files accessible in Mac OS X?

I have a db file which I want to open using a firefox plugin.
However, I can't open the file.
I've also got other files like this with other file types.
I'm sure I've had this problem before, any ideas ?
I've tried...
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
But that didn't work.
Mac OS X displays all of the files in a particular folder on your disk in its Open/Save common dialogs, but it grays out the ones that are in a format that can't be opened by whatever program's Open/Save dialog you're browsing from.
The title of the dialog in the screenshot above gives away your problem. It says "Set Default Directory", which means it's only looking for a folder. The file "bc.db" is just that: a file. Whatever program you're trying to open it from isn't willing to accept it because a file is not interchangeable with a folder/directory. That explains why none of your other file types work, either. You need to choose a folder from that dialog to set as the default.
It's also worth nothing that the .DB extension means that file is a database file of some sort. It's very likely that it's in a proprietary format that can only be read by one particular application. Thus, even if you try to open it from the Finder, you're not likely to get very far. You need to figure out what program originally generated that file and try to open/use it there.

New OSX User: Opening up a new terminal window in current space(?)

I'm just meddling with OSX after a few years on Linux. There's a lot that I'm liking, but one thing that's slowing me down is that if I run the 'terminal' command via shortcut/spotlight/quicksilver, it whisks me off to any existing terminal in whatever space already has a terminal instance open.
I regularly like to pop up a terminal, run a quick command and then close it again, all the while staying in whatever desktop space I happen to be on.
...So, how do I do that on Mac?
Cheers...
Go to System Preferences -> Exposé & Spaces -> Spaces and check When switching to an application, switch to...
Download this tool called Visor
It lets you quickly get a tabbed drop down terminal using a hotkey like Ctrl-`.
Insanely convenient for working in the shell.
Try this tool: https://github.com/nmadhok/OpenInTerminal
This is a really handy tool for programmers on Mac as it lets you open the folder directly in Terminal. You can select multiple folders to open them in multiple terminal windows. You can also select files to open the parent directory in Terminal. This application works with Finder as well as without Finder which is a plus!

Resources