Check if an app is installed on MacOS using the Terminal - bash

I'm making a small cross-platform CLI tool in TypeScript/NodeJs. Its key feature requires that it needs to check which browsers are installed on the host. On Linux and Windows, it works flawlessly. I did a lot of research on how I can achieve that and currently I'm using "reg query" for Windows and "which" for Unix-based OS - Linux, but I don't know where to start with MacOS.
I know it's a Unix-like OS but I can't test my tool. Can someone please help me because I don't physically own a MacBook so I cannot test which bash command should I use. I'm not asking you to write the complete code, just which command(s) to use or even better, a working example (screenshot) of the command that works properly. I know I could use "which", "type" or even "open -Ra" (not sure about this one) I just don't know what's their output.

The command:
mdfind "kMDItemKind == 'Application'"
will output a list of installed Apps on the system (one per line) with their paths. E.g.:
/Applications/Safari Technology Preview.app
/Applications/Safari.app
You can search your supported browsers in this list.

It depends on what is meant by "installed". I can think of two different definitions:
Apps appearing in Launchpad.
Apps appearing in System Information > Applications which could be launched via open -a {app} from a terminal or navigating to the app folder and double-clicking on it. Their locations cover the entire Spotlight index: normally the entire hard drive minus Spotlight exclusions.
For #1, expanding on #mschmidt's answer we can use, for example:
mdfind -name 'Google Chrome.app' -onlyin /Applications -onlyin ~/Applications -onlyin /System/Applications
(I'm not positive that those are the only roots used by Launchpad.)
For #2 we can use:
mdfind -name 'Google Chrome.app'
This would find it anywhere in Spotlight and this is indeed what open -a can open.
Tested on Catalina.

You can also use the following:
mdfind -name 'kMDItemFSName=="*.app"' -onlyin /Volumes/Macintosh_HD/Applications/
or
mdfind -name 'kMDItemFSName=="*.app"' -onlyin /Volumes/Macintosh\ HD/Applications/ |cut -d "/" -f3|grep .app

The Mac OS is built on the Unix version Free BSD. Many Linux commands will probably work on the Mac as well. To access that part of the OS, the terminal emulators "Terminal" and "iTerm" can be used. The "which" command works fine on a Mac.
If your challenge is just to find the browsers on a Mac computer I's use the ls command piped into grep. Most apps on a Mac computer are stored in the Applications folder. This folder is located at the root level. To find a specific browser I'd type:
> cd Applications
> ls -l | grep -i BrowserName
You can do this for each browser you know of. I don't know how to find browsers in general. If you do you may just try the same command on the Mac.
If you need more help feel free to leave a comment.

Related

How do you make .sh or .bash files open with Windows Terminal Ubuntu?

I really like coding in bash, but there used to be many limitations of bash functionality in Windows. Though now there are many benefits to the bash windows users now rather than how it was pre windows 10. However, with all of the improvements, there is one thing that I feel leaves to be desired for me. The default behavior of the double-click of .sh files never really was able to do anything in windows, the .sh file extension isn't even available in the "choose default apps by file type" section of the settings. I had a desire to be able to change the default action for .sh files but neglected it and shook it off for a while, but this link finally gave me hope.
Before Ubuntu terminal and the addition of Windows subsystem for Linux, there was really no way to access bash terminal on Windows without a VM. Now with the addition of Windows Terminal which combines Microsoft Azure Terminal, Command Prompt, Powershell, and Ubuntu, it is really awesome for people like me, but despite the new awesome additions to windows allowing further integration of Linux terminal into Windows, even being able to edit the C: drive with Ubuntu.
I am sure there is a way to allow double-click of .sh files to open in windows terminal Ubuntu, but I don't know how. This question helped me on my journey to figure out how to do it and helped me make the default .bat file behavior change to Windows terminal, but I still have come to an enpass where I truly believe that it is not possible. So here is where I go when I have given up, the magical land of Stack Overflow :)
Attempts
So far I have looked into the "Choose default apps by file extension" section of settings and could not find .sh in there nor could I find it in any of the default apps sections of normal settings.
After I couldn't find anything about .sh in settings, I looked into the registry and looked for HKEY_CLASSES_ROOT and looked for sh or anything bash file related in HCR alone, HCR\*\shell, HCR\*\shellx, and HCR\*\Openwithlist and could not find anything.
I then tried to do ftype, but I could not find how to use ftype with .sh. I tried doing ftype .sh="C:\Users\asian\AppData\Local\Microsoft\WindowsApps\wt.exe" -p "Ubuntu" "%1" %* but i got the error "File type '.sh' not found or no open command associated with it."
I Also tried just clicking the .sh file so it brings up the "How do you want to open this file" menu and went to Windows Terminal but it opened the bash file in powershell with the error [error 0x800700c1 when launching `C:\Users\asian\Desktop\test.sh']
These where everything I could think of and none of it was working. Help and pointers are appreciated. Thank you!
I suggest you install the Git for Windows package, as it comes with a light-weight bash environment. This is likely to be able to be in the list of available apps when right-click -> Properties on a .sh or .bash file and say Open With and click the Change button next to Open With.
Other options are Cygwin or WSL for a 95% pure Linux environment on Windows.

Get list of open files (descriptors) in OS X

I would like to get a list of open files in a process on os x (10.9.1). In Linux I was able to get this from /proc/PID/fd. However I'm not sure how to get the same on OS X. I found that the procfs is not present on the OS X (by default. possible implementations present, but I do not want to go that way).
So how do I get (natively) the list of open files in a process on OS X. One way is lsof. is there any other support available? please let me know where I can get more info on this.
Thanks.
I had a hard time getting Activity Monitor to show open files for a process that was running as root (via sudo). The original question mentions lsof, and it does the trick exactly. If you know the process name or PID, it's super quick.
Find processes by name:
lsof -c processname
Find processes by PID:
lsof -p 123
(Prefix with sudo as needed, such as if you are not the owner of the process.)
At least on OSX 10.10 (Yosemite, didn't check on Mavericks), you can get the list of open files by process via the default activity monitor application. Just double click on the relevant process on the list and select "Open Files and Ports" tab on the popup.
Tip: cmd+f shortcut on that pane allows for searching and highlighting on the content.
This works for some things:
sudo fs_usage | grep dev
for /dev/ files or similar.
The clean and simple approach to inspect the current process (i.e. the equivalent of /proc/self/fd on Linux) is to use ls /dev/fd/:
e.g.
$ touch "file"
$ exec 3<>file
$ ls /dev/fd/
0 1 2 3
List open files on /Volumes/VolumeName:
lsof | grep "/Volumes/VolumeName"
"You can get the list of open files by process via the default activity monitor application. Just double click on the relevant process on the list and select "Open Files and Ports" tab on the popup."
But "you had a hard time getting Activity Monitor to show open files for a process that was running as root (via sudo) or others user".
So just run Active Monitor by sudo, that`s it
sudo /Applications/Utilities/Activity\ Monitor.app/Contents/MacOS/Activity\ Monitor
I use the What's Open application that is very handfull (with filters, disk selection, ...).
You can find it there : http://whatsopen.en.softonic.com/mac.
Since you asked "Is there any other support [than lsof] available?", try this:
Create a command line tool using the "proc_pidinfo" C API referenced in the selected answer to this question: How can I programmatically get the list of open file descriptors for a given PID on OS X?
You can use proc_pidinfo with the PROC_PIDLISTFDS option to enumerate the files used by a given process. You can then use proc_pidfdinfo on each file in turn with the PROC_PIDFDVNODEPATHINFO option to get its path.
lsof -c /^74016$/ -d^txt -FcfadDtns0
The -F instructs lsof to produce output suitable for consumption by another process, such as Perl or awk. In man lsof search for OUTPUT FOR OTHER PROGRAMS for details. The characters that come after -F represent a field you want to select for output. The output then puts each of these characters in front of the respective field. Example output:
p212^#cloginwindow^#
fcwd^#a ^#tDIR^#D0x1000004^#s704^#n/^#
f0^#ar^#tCHR^#D0xf218cacb^#n/dev/null^#
f1^#au^#tCHR^#D0xf218cacb^#n/dev/null^#
f2^#au^#tCHR^#D0xf218cacb^#n/dev/null^#
f3^#ar^#tREG^#D0x1000004^#s216424^#n/Library/Application Support/CrashReporter/SubmitDiagInfo.domains^#
f4^#ar^#tREG^#D0x1000004^#s77^#n/private/etc/security/audit_user^#
f5^#ar^#tREG^#D0x1000004^#s652^#n/private/etc/security/audit_class^#
f6^#ar^#tREG^#D0x1000004^#s358^#n/private/etc/security/audit_control^#
f7^#ar^#tREG^#D0x1000004^#s111033^#n/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_stdlib.metallib^#
f8^#au^#tIPv4^#d0xc401abd77f1dd1d9^#n*:*^#
f9^#ar^#tREG^#D0x1000004^#s308316^#n/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_filters.metallib^#
f10^#au^#tREG^#D0x1000004^#s1536^#n/private/var/folders/4g/3lkhwv6n7_76_1s8snscvhxc0000gp/C/com.apple.loginwindow/com.apple.metal/3902/libraries.maps^#
f11^#au^#tREG^#D0x1000004^#s65536^#n/private/var/folders/4g/3lkhwv6n7_76_1s8snscvhxc0000gp/C/com.apple.loginwindow/com.apple.metal/3902/libraries.data^#
f12^#au^#tREG^#D0x1000004^#s1536^#n/private/var/folders/4g/3lkhwv6n7_76_1s8snscvhxc0000gp/C/com.apple.loginwindow/com.apple.metal/Intel(R) HD Graphics 630/functions.maps^#
f13^#au^#tREG^#D0x1000004^#s131072^#n/private/var/folders/4g/3lkhwv6n7_76_1s8snscvhxc0000gp/C/com.apple.loginwindow/com.apple.metal/Intel(R) HD Graphics 630/functions.data^#
p421^#ccoreauthd^#
fcwd^#a ^#tDIR^#D0x1000004^#s704^#n/^#
f0^#ar^#tCHR^#D0xf218cacb^#n/dev/null^#
f1^#au^#tCHR^#D0xf218cacb^#n/dev/null^#
f2^#au^#tCHR^#D0xf218cacb^#n/dev/null^#
p537^#cUserEventAgent^#
fcwd^#a ^#tDIR^#D0x1000004^#s704^#n/^#
f0^#ar^#tCHR^#D0xf218cacb^#n/dev/null^#
f1^#au^#tCHR^#D0xf218cacb^#n/dev/null^#
f2^#au^#tCHR^#D0xf218cacb^#n/dev/null^#
f3^#au^#tunix^#d0xc401abd77b9c8579^#n->0xc401abd77b9c8709^#
f4^#au^#tunix^#d0xc401abd77b9c7129^#n->0xc401abd77b9c8899^#

Enumerate All Installed Applications on OS X

Basic problem
I'm looking for a solution to enumerate all applications installed on a (Mac) OS X system, i.e. all application bundles registered with LaunchServices.
Simple approach that did not work
(Please note: lsregister can be found under /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister).
Currently I am using the output of lsregister -dump | grep -E '^.*[ \\t]*path:[ \\t]+(\/.*)$' | grep -Eo '\/.*', which has a few problems:
.app bundles with newlines (\n, which is valid on UNIX) are not handled correctly (This issue would be fixable by writing a proper parser)
lsregister doesn't handle correctly weird filename (e.g. containing the RTL mark). lsregister just seems to ignore files with the RTL mark in their name.
If you want to, you can create a file with RTL in its name by running the following command.
python -c 'import shutil; shutil.copytree(u"/Applications/TextEdit.app", u"/Applications/ThisIsAWeird\u202EApp.app")'
After doing this, lsregister -dump | grep ThisIsAWeird will not reveal it. But when you right click on a text file and go to "Open With" you'll that LaunchServices and Finder still support that file.
Simply enumerating all files in /Applications and other directories does not work because LaunchServices is aware of application bundles in arbitrary folders and I also need these apps.
Other approch that I didn't get to work
Apparently, there's a private API function called _LSFindApplications which does exactly what I need to do but I can't get it to work and didn't find any inofficial documentation on the internet. (proof it exists: nm /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/LaunchServices | grep __LSFindApplications$)
UPDATE: system_profiler method also doesn't seem to work
Until now I though the system_profiler method as suggested by #Anoop works but today I found out that lsregister still picks up more binaries. Some or missing on all machines, some seems to be only missing in system_profiler when you have mounted an external volume with another installation of OS X. Here's a list what's missing in the output of system_profiler (but is present in lsregister) on one of my machines:
/Applications/Automator.app/Contents/Resources/Application Stub.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Framework.framework/Resources/app_mode_loader.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Framework.framework/Resources/crash_report_sender.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper EH.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper NP.app
/Applications/Google Chrome.app/Contents/Versions/30.0.1599.69/Google Chrome Helper.app
/System/Library/CoreServices/AddPrinter.app
/System/Library/CoreServices/AirPlayUIAgent.app
/System/Library/CoreServices/AppleFileServer.app
/System/Library/CoreServices/AppleGraphicsWarning.app
/System/Library/CoreServices/AppleScript Runner.app
/System/Library/CoreServices/AppleScript Utility.app
/System/Library/CoreServices/CalendarFileHandler.app
/System/Library/CoreServices/Certificate Assistant.app
/System/Library/CoreServices/CoreLocationAgent.app
/System/Library/CoreServices/CoreServicesUIAgent.app
/System/Library/CoreServices/CoreTypes.bundle
/System/Library/CoreServices/Database Events.app
/System/Library/CoreServices/DiskImageMounter.app
/System/Library/CoreServices/Expansion Slot Utility.app
/System/Library/CoreServices/File Sync.app
/System/Library/CoreServices/FileSyncAgent.app
/System/Library/CoreServices/Folder Actions Dispatcher.app
/System/Library/CoreServices/Folder Actions Setup.app
/System/Library/CoreServices/HelpViewer.app
/System/Library/CoreServices/Image Events.app
/System/Library/CoreServices/Install in Progress.app
/System/Library/CoreServices/Jar Launcher.app
/System/Library/CoreServices/Java Web Start.app
/System/Library/CoreServices/KeyboardSetupAssistant.app
/System/Library/CoreServices/Language Chooser.app
/System/Library/CoreServices/LocationMenu.app
/System/Library/CoreServices/MRTAgent.app
/System/Library/CoreServices/Memory Slot Utility.app
/System/Library/CoreServices/NetAuthAgent.app
/System/Library/CoreServices/Network Diagnostics.app
/System/Library/CoreServices/Network Setup Assistant.app
/System/Library/CoreServices/ODSAgent.app
/System/Library/CoreServices/Pass Viewer.app
/System/Library/CoreServices/Printer Setup Utility.app
/System/Library/CoreServices/RegisterPluginIMApp.app
/System/Library/CoreServices/Screen Sharing.app
/System/Library/CoreServices/SecurityAgent.app
/System/Library/CoreServices/SecurityFixer.app
/System/Library/CoreServices/SocialPushAgent.app
/System/Library/CoreServices/System Events.app
/System/Library/CoreServices/System Image Utility.app
/System/Library/CoreServices/SystemUIServer.app
/System/Library/CoreServices/Ticket Viewer.app
/System/Library/CoreServices/UniversalAccessControl.app
/System/Library/CoreServices/UnmountAssistantAgent.app
/System/Library/CoreServices/UserNotificationCenter.app
/System/Library/CoreServices/VoiceOver.app
/System/Library/CoreServices/ZoomWindow.app
/System/Library/CoreServices/backupd.bundle/Contents/Resources/TMLaunchAgent.app
/System/Library/CoreServices/loginwindow.app
/System/Library/CoreServices/rcd.app
/System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app
/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/QuickLookUI.framework/Versions/A/Resources/QuickLookUIHelper.app
/System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app
/System/Library/PrivateFrameworks/DiskImages.framework/Versions/A/Resources/DiskImages UI Agent.app
/System/Library/Services/AppleSpell.service
/System/Library/Services/ChineseTextConverterService.app
/System/Library/Services/ImageCaptureService.app
/System/Library/Services/OpenSpell.service
/System/Library/Services/SpeechService.service
/System/Library/SocialServices/Facebook.socialplugin
/System/Library/SocialServices/Twitter.socialplugin
/System/Library/SocialServices/Weibo.socialplugin
First, your request is not quite right:
I'm looking for a solution to enumerate all applications installed on a (Mac) OS X system, i.e. all application bundles registered with LaunchServices.
Those are not the same thing. The application bundles registered with LaunchServices is the output of lsregister -dump. That is not the same thing as "all applications installed." There is no exact query for "all applications installed." OS X does not even really have such a concept.
The output of system_profiler is equivalent to what Spotlight knows about. That's not exactly the full list of installed applications, and may not be correct in several cases. Spotlight may have been disabled, for instance, or it may not have completed its first scan. (There is no supported way to ask Spotlight if it has finished its first scan; radar 15177626.)
There is also pkgutil --pkgs which will provide you additional "installed things." It isn't complete either, and may list things that are not installed.
You can also use mdfind to walk the whole disk and see what calls itself an application. This is pretty effective, but slow.
You can also use locate .app | grep '\.app$' which is pretty effective if the locate database is up to date and you only want app bundles.
I asked Apple about this at WWDC. There is no simple, supported answer. Open a radar. You can ask to dupe 15177489.
in terminal:
system_profiler SPApplicationsDataType > list_of_all_apps.txt
... writes output of the system_profiler query to that text file.
What about find using Cocoa application/code as done here.
Also, you might be able use to use system_profiler -xml SPApplicationsDataType and then parse the resulting XML data to get just the applications that you are interested in.

How to launch an app on OS X with command line - The best way

I want to launch an app on OSX from a script. I need to pass some command line arguments. Unfortunately, open doesn't accept command line args.
The only option I can think of is to use nohup myApp > /dev/null & to launch my app so it can exist independently of the script that launches it.
Any better suggestions?
As was mentioned in the question here, the open command in 10.6 now has an args flag, so you can call:
open -n ./AppName.app --args -AppCommandLineArg
In OS X 10.6, the open command was enhanced to allow passing of arguments to the application:
open ./AppName.app --args -AppCommandLineArg
But for older versions of Mac OS X, and because app bundles aren't designed to be passed command line arguments, the conventional mechanism is to use Apple Events for files like here for Cocoa apps or here for Carbon apps. You could also probably do something kludgey by passing parameters in using environment variables.
An application bundle (.app file) is actually a directory. Instead of using open and the .app filename, you can move into the app's directory and start the actual machine code program located inside. For instance:
$ cd /Applications/LittleSnapper.app/
$ ls
Contents
$ cd Contents/MacOS/
$ ./LittleSnapper
That is the actual binary executable that might accept arguments (or not, in LittleSnapper's case).
In case your app needs to work on files (what you would normally expect to pass as: ./myApp *.jpg), you would do it like this:
open *.jpg -a myApp
You can launch apps using open:
open -a APP_YOU_WANT
This should open the application that you want.
open also has an -a flag, that you can use to open up an app from within the Applications folder by it's name (or by bundle identifier with -b flag). You can combine this with the --args option to achieve the result you want:
open -a APP_NAME --args ARGS
To open up a video in VLC player that should scale with a factor 2x and loop you would for example exectute:
open -a VLC --args -L --fullscreen
Note that I could not get the output of the commands to the terminal. (although I didn't try anything to resolve that)
I would recommend the technique that MathieuK offers. In my case, I needed to try it with Chromium:
> Chromium.app/Contents/MacOS/Chromium --enable-remote-fonts
I realize this doesn't solve the OP's problem, but hopefully it saves someone else's time. :)
Lots of complex answers when you can simply access Applications folder and type:
open -a [APP NAME]
This is it!
I wanted to have two separate instances of Chrome running, each using its own profile. I wanted to be able to start them from Spotlight, as is my habit for starting Mac apps. In other words, I needed two regular Mac applications, regChrome for normal browsing and altChrome to use the special profile, to be easily started by keying ⌘-space to bring up Spotlight, then 'reg' or 'alt', then Enter.
I suppose the brute-force way to accomplish the above goal would be to make two copies of the Google Chrome application bundle under the respective names. But that's ugly and complicates updating.
What I ended up with was two AppleScript applications containing two commands each. Here is the one for altChrome:
do shell script "cd /Applications/Google\\ Chrome.app/Contents/Resources/; rm app.icns; ln /Users/garbuck/local/chromeLaunchers/Chrome-swirl.icns app.icns"
do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --user-data-dir=/Users/garbuck/altChrome >/dev/null 2>&1 &"
The second line starts Chrome with the alternate profile (the --user-data-dir parameter).
The first line is an unsuccessful attempt to give the two applications distinct icons. Initially, it appears to work fine. However, sooner or later, Chrome rereads its icon file and gets the one corresponding to whichever of the two apps was started last, resulting in two running applications with the same icon. But I haven't bothered to try to fix it — I keep the two browsers on separate desktops, and navigating between them hasn't been a problem.
Beginning with OS X Yosemite, we can now use AppleScript and Automator to automate complex tasks. JavaScript for automation can now be used as the scripting language.
This page gives a good example example script that can be written at the command line using bash and osascript interactive mode. It opens a Safari tab and navigates to example.com.
http://developer.telerik.com/featured/javascript-os-x-automation-example/
osascript -l JavaScript -i
Safari = Application("Safari");
window = Safari.windows[0];
window.name();
tab = Safari.Tab({url:"http://www.example.com"});
window.tabs.push(tab);
window.currentTab = tab;
Simple, here replace the "APP" by name of the app you want to launch.
export APP_HOME=/Applications/APP.app/Contents/MacOS
export PATH=$PATH:$APP_HOME
Thanks me later.
With applescript:
tell application "Firefox" to activate
Why not just set add path to to the bin of the app. For MacVim, I did the following.
export PATH=/Applications/MacVim.app/Contents/bin:$PATH
An alias, is another option I tried.
alias mvim='/Applications/MacVim.app/Contents/bin/mvim'
alias gvim=mvim
With the export PATH I can call all of the commands in the app. Arguments passed well for my test with MacVim. Whereas the alias, I had to alias each command in the bin.
mvim README.txt
gvim Anotherfile.txt
Enjoy the power of alias and PATH. However, you do need to monitor changes when the OS is upgraded.
To Create a New Text File OR open an existing one, in any folder, using a Text/Code Editor like the Free TextMate app on MACOSX, use this command on Terminal:
open -n /Applications/TextMate.app --args "$PWD/some file.txt"
Instead of a Text File, you can use any file type, based on your app's requirements and its support for this syntax.
This command also simulates the New Text Document Here Command on Windows and has been tested on MacBook Pro 2021 and Monterey 12.2.1 successfully.

Bash: Getting standard program for file type

the background is a shell script to open the .m3u file of a web radio station. Therefore I want to know inside the script, what's the user's program to open such files. At the moment, he has to set the environment variable $PLAYER, but obviously that is not a good way to go.
Alternative: Is there a command that takes a filename and searches itself for an appropriate program to handle that file? Like file, e.g.,
open-file my_playlist.m3u
The script should be portable, it will run at least on Ubuntu, Debian and Windows/Cygwin machines.
Cheers,
This will have to be done differently on each platform. On Mac OS X the "open" command will do what you want.
In Linux it gets murky, since the desktop environment (GNOME or KDE) keeps its own list of applications to run for each file type.
There are two files you can look for in Ubuntu / GNOME that hold this info:
~/.local/share/applications/defaults.list and
~/.local/share/applications/mimeinfo.cache
Someone else hopefully knows how to do this in Windows and can chime in.
Edit: Stealing from the other answers:
Linux:
xdg-open [filename]
Cygwin:
cygstart [filename]
And for completeness, here's a link to a previous question about how to detect which operating system you are running on: Detect OS from bash Script
I'd like if there were a different answer to this but I think you'll have to check the file association configs for every desktop environment and file manager out there (so, nautilus, konqueror, thunar, mc... all in different places and in different formats AFAIK), as well as ascertaining which one of these the user is actually using...
If someone has a different idea I'm keen to hear it.

Resources