Mac os terminal close application

Открытие и завершение приложения «Терминал» на Mac

Каждое окно в Терминале представляет свой экземпляр процесса shell. Окно содержит приглашение, которое означает, что можно вводить команду. Отображаемое приглашение зависит от настроек Терминала и shell, однако обычно оно включает имя хоста, к которому Вы подключены, Вашу текущую рабочую папку, Ваше имя пользователя и символ приглашения. Например, если пользователь с именем michael использует по умолчанию оболочку zsh, приглашение выглядит следующим образом:

В приглашении указано, что пользователь с именем michael вошел в систему на компьютере с именем MacBook-Pro и текущей папкой является его папка пользователя, обозначаемая тильдой (

Открытие Терминала

На компьютере Mac выполните одно из следующих действий.

Нажмите значок Launchpad в панели Dock, введите «Терминал» в поле поиска и нажмите значок Терминала.

В окне Finder откройте папку «Программы/Утилиты» и дважды нажмите приложение «Терминал».

Завершение приложения «Терминал»

В приложении «Терминал» на Mac выберите пункт меню «Терминал» > «Завершить Терминал».

Завершение сеанса shell

В окне приложения «Терминал» на Mac, где запущен процесс shell, который Вы хотите завершить, введите exit и нажмите клавишу Return.

Это обеспечит закрытие всех текущих команд, выполняемых в shell. Если что-то продолжает выполняться, появляется диалоговое окно.

Если Вы хотите изменить поведение при выходе из shell, см. Изменение настроек shell для профилей.

Источник

Gracefully Close an Application from the Command Line in Mac OS X

Quitting apps gracefully is typically done through the appropriate application menu by choosing “Quit”, but the Mac GUI is obviously inaccessible from the command line of Mac OS X. So when most command line users are confronted with the need to exit an application, they wind up using the ‘kill’ command to terminate the process and forcibly quit the app, rather than issuing a ‘soft’ kill. The obvious problem with terminating an app is that while it does exit the application, you may lose data in that process, and even session restoration caches may not be adequate to restore the data. Thus, whenever possible, it’s usually best for users to gracefully quit an application instead.

Though it’s not particularly well known, you can send a standard quit signal to any Mac OS X GUI app from the command line with the assistance of the osascript command. It’s fairly easy to use, and that’s what we’ll cover here.

How to Gracefully Quit Apps from the Terminal in Mac OS X with osascript

Again, this will issue a standard quit signal to an application, rather than a kill (terminate) signal. That also means the target application won’t forcibly exit if there is unsaved data without prompting the user for input (unless you have auto-save setting enabled for Mac OS X and the application doesn’t prompt the user as a result).

The basic syntax to send a standard quit signal to a GUI application in Mac OS X from Terminal is as follows:

osascript -e ‘quit app «APPLICATIONNAME»‘

For example, to quit Calendar from the command line, replace APPLICATIONNAME with “Calendar”

osascript -e ‘quit app «Calendar»‘

Because Calendar syncs and doesn’t have a save option, you won’t be presented with the standard save dialog when trying to close the app. With apps that do have save options and when Mac OS X has auto-save disabled, the save dialog box will be summoned as usual.

Another advantage to using osascript to close apps gracefully is that you can provide an actual application name, which is much easier to remember and quite a bit more user friendly than relying entirely on process ID numbers that go with the kill command. Note that modern versions of Mac OS X offer an improved kill command that is more user friendly, known as pkill.

You could use this in a bash script to close out applications from the command line, or even modify it to behave similarly to the “Quit All Open Apps” with Automator trick we covered a while back.

Читайте также:  Windows 10 release microsoft com

Источник

6 ways to quit an app on your Mac

When it comes to macOS, closing apps is a little different than on Windows machines. Rather than closing the window, you have to actually quit the app, otherwise is stays running on your Mac even though the window has been closed.

Most Mac users are aware of how to quit an app on their Mac, but in this piece, we’ll be sharing six ways you can quit apps on your Mac so you can experiment with various app-quitting methods.

Quitting apps on your Mac

Although you could technically leave all your apps open in the background due to the macOS power efficiency abilities, quitting your unused apps is a good idea if you’re not going to need to use them again for a while. This helps clean up your Dock and Desktop of unnecessary clutter and makes it easier to find what you’re looking for when you go to launch an app in the future.

You know an app is running when the icon is showing in the Dock and a black dot appears underneath the app icon, like this:

Alternatively, you might see the app showing in the Menu Bar instead of an app icon showing in the Dock.

There are multiple ways to quit apps on your Mac, and today we’ll be showing you six ways this can be done.

1) Menu Bar menu method

Perhaps the most widely-used method of quitting an app is by using the Menu Bar menu. I would expect most people find this to be one of the easiest ways to quit an app because it’s always easy to get to.

To quit an app from the Menu Bar, make sure the app you want to quit is running in the foreground, and click on the app’s name from the Menu Bar.

Then, choose the “Quit” option from the drop-down menu. In this case, because we’re quitting the Mail app, we’ll go to Mail > Quit Mail from the Menu Bar on our Mac.

2) Dock app icon method

Possibly the second most popular way to quit an app on a Mac due to the ease of accessibility is from the Dock.

When an app is running, you can simply right-click on an app from the Mac’s application Dock and a pop-up menu appears.

From this pop-up menu, select the Quit option and the app will quit. Following this gesture, the black dot underneath the app should disappear, indicating the app has been terminated.

3) Keyboard shortcut method

Yet another way to quit apps on your Mac is with a humble keyboard shortcut.

With the app you want to quit running in the foreground, you can press Command ⌘ + Q on the keyboard simultaneously to quit the app.

The keyboard shortcut method is a quick and effective way to quit apps, especially when your Mouse or Trackpad may not be responding.

4) Menu Bar icon method

Although we showed you how to quit apps from the Dock and Menu Bar menu, some apps don’t appear in the Dock at all, but instead show up as icons in the Menu Bar instead.

These apps typically don’t give you the option to quit from the Menu Bar menu either because the name never appears there, so there’s a different process involved and we’ll touch on that very quickly for you.

For this specific class of apps, you’ll just click on the icon from the Menu Bar and a drop-down menu will appear.

In this drop-down menu, you should be able to find a Quit option that will let you terminate the app.

This method really only applies to third-party apps you downloaded, but it’s good to know nonetheless.

5) Activity Monitor method

Your app comes with a utility called Activity Monitor, and it’s really useful for monitoring hardware and resource usage on your machine.

The app is also useful for quitting apps on your Mac. To use it, launch it from your Applications > Utilities folder and then click on the app in the application list that you want to quit.

Next, you’ll click on the quit button at the top left of the Activity Monitor window, and from the prompt that appears, you’ll click on the blue Quit button.

Afterwards, the app will be terminated, and you can repeat the process for any running processes or apps on your Mac.

Читайте также:  Ati rs600m драйвер windows 10

Note: Because processes are shown here, in addition to apps, be mindful of what you quit.

6) Terminal method

The final method to quit apps on your Mac that we’ll be talking about today is using the Terminal’s command line interface.

Most people avoid the command line interface because it can be confusing and isn’t as pretty as a graphical user interface is, but by no means is it less effective at getting the job done.

When you want to quit an app using the Terminal, launch Terminal from the Applications > Utilities folder on your Mac.

In the Terminal, you’ll want to type the following command:

osascript -e ‘quit app “[insert app name here]”‘

You will replace the [insert app name here] text with the name of the app you wish to close. In this case, we’re quitting the Mail app, so we’ve replaced the text with Mail in the command.

After you’re done typing the command, hit the Return key on your keyboard, and the app will be terminated.

Wrapping up

Chances are, if you’re a Mac user, you already know how to quit apps on your Mac, but hopefully you’ve picked up on an additional method or two after reading this piece that you can try next time you have to quit an app, or you can help spread the word to other novice Mac users.

Do you have a favorite way to quit an app on your Mac? Share in the comments or visit us on Twitter!

Источник

Как завершить приложение в macOS с помощью Терминала

Время от времени все владельцы яблочных настольных компьютеров сталкиваются с необходимостью быстро завершить приложение или процесс, который либо завис, либо потребляет слишком много ресурсов. Обычно для этих целей используют утилиту под названием Мониторинг система. Однако владельцы «маков» могут пойти и другим путем.

Кроме встроенной утилиты Мониторинг системы для снятия процесса или приложения можно использовать Терминал и ряд специальных команд, таких как klii PID, killall и pkill.

В первом случае для завершения процесса или приложения пользователям нужно узнать уникальный номер – PID. Его можно посмотреть в утилите Мониторинг системы во вкладке ЦП.

Другие две команды позволяют и вовсе обойтись без запуска Мониторинга системы. Для завершения необходимого процесса в команду достаточно просто подставить его имя.

Команда killall

Команду killall можно считать самой популярной командой для снятия отдельного приложения. Для ее использования нужно:

  1. Ввести команду killall и название процесса. Например, killall iTunes

После этого выбранный процесс будет завершен. Однако стоит помнить, что закрытие приложения с помощью этой команды может привести к потере данных, с которыми вы работали.

Команда pkill

Команда pkill также позволяет быстро завершить процесс или сразу несколько процессов. Например, ее можно использовать для завершения всех программ, принадлежащих конкретному пользователю.

Для использования команды нужно:

  1. Ввести команду pkill и имя процесса. Например, pkill Safari.

Также c помощью pkill можно завершить все процессы, начинающиеся с буквы C — pkill C*

Источник

6 Ways to Force Quit Mac Applications

Do you need to force quit an unresponsive Mac app? Is your Mac seeing the infamously dreaded spinning beachball of death? Is an app failing to respond to any input? Maybe you have an errant process or two? When any of the above happens, you’ll probably want to forcibly quit the application in question, and that’s what we’ll cover with this walkthrough, showing you how to force quit apps on a Mac with six different methods.

Whatever your skill level with Mac, you’ll find a way to forcibly exit out of an app. Read on to learn more!

How to Force Quit Mac Apps: 6 Different Ways

Take a moment to review the tricks below, and then remember a few keyboard shortcuts or sequences now to save yourself a hassle later if you find yourself in a situation where you need to force quit a Mac app. And yes, these tricks work in all versions of Mac OS and Mac OS X.

1) Use a Keyboard Shortcut for “Force Quit Applications” on Mac

Starting with one of the best and easiest is the system wide Force Quit function: Hit Command+Option+Escape from anywhere to bring up the simple “Force Quit Applications” window, then click on the app name to select, followed by clicking the “Force Quit” button, this will end the app immediately.

Think of this as a simplified version of Activity Monitor, and it’s also a great keystroke to remember to use since it allows for quickly ceasing multiple apps. If you’re going to remember nothing else for force quitting apps in Mac OS X, remember this keystroke: Command + Option + Escape

That Force Quit keyboard shortcut is probably the best combination of easy and power when force quitting apps in Mac OS X, since you can access it with a keystroke, select and force quit multiple apps if necessary, and summon it from anywhere.

Читайте также:  Linux для фотографа 2020

2) Force Quit Currently Active Mac App with the Keyboard

Hold down Command+Option+Shift+Escape for a second or two until the app forcibly closes. Be sure to do this while the app you want to force quit is the foremost application on the Mac, as it will force quit whatever is active when held down.

This is not well known, but offers perhaps the quickest way to force quit the foreground application in Mac OS X and a very good keyboard shortcut to remember.

3) Force Quitting Apps from the Dock

Option + Right Click on an apps icon in the Dock to bring up the “Force Quit” option, selecting this will kill the app without any confirmation.

4) Force Quit an App from the Apple Menu

Hold the Shift Key and click on the  Apple menu to find “Force Quit [Application Name]”.

This is easy to remember but not necessarily the most powerful method, since sometimes an application is completely unresponsive and the menus are inaccessible.

5) Use Activity Monitor to Force Quit Apps

Activity Monitor is a powerful way to forcibly quit any app, task, daemon, or process running on Mac OS X. You can find it in /Applications/Utilities/ or open it from Spotlight with Command+Space and then type ‘Activity Monitor’ and the return key. Using Activity Monitor is very easy: Select the process name or ID you wish to kill (unresponsive apps will usually appear as red), and hit the red “Quit Process” button.

You can think of this as the Mac equivalent to a task manager from the Windows world and a more complex version of the second tips Force Quit window. If one of the previous methods fails, this will almost certainly work.

6) Using the Terminal & kill Command

If all else fails, using the command line is a surefire way to force an app or process to quit by issuing the low-level kill command. Launch the Terminal and type one of the following commands:

For example, “killall Safari” would kill all instances of the Safari process. If you know the process id, which you can find with the ps or ‘ps aux’ command. Aim kill at that process specifically:

The kill commands will take out just about anything, and sometimes have the side effect of not honoring Versions, Window Restore, and Auto-Save, so be cautious of potential data loss.

Another option for command line users is the pkill command, which works similar to the kill command to forcibly exit and close applications and processes.

What’s your preferred method of forcibly quitting an app? Mine is the Command+Option+Escape trick, or by using Activity Monitor, but I often turn to the command line for more complex situations.

Remember, when you force quit an app, you will lose any unsaved data in that application. Don’t forget that.

Bonus Force Quit Tips

You can also force quit several Mac apps at the same time if you find yourself in a situation requiring that.

Mac users without an ESC key will instead need to get accustomed to force quitting with Touch Bar, which can sometimes be a few extra steps to access the escape option.

Rebooting a Mac will also initiate soft quit, but if you force reboot a Mac or turn it off, then it will basically force quit out of apps as well – that’s pretty extreme though so it’s best to avoid that method for quitting any app as it’s not intended for really anything other than a totally frozen Mac.

This obviously covers the Mac, but from the iOS side of things, you can force quit apps on iPhone, iPad, or iPod touch, as well, depending on the version of iOS and the iOS device itself. Swiping up from the bottom of the screen on a new device and then swiping up to discard the app will force quit on any new iPhone or iPad, and older models can force quit by double-pressing Home button to then initiate the quit app process. And finally, much older iOS versions can accomplish this by holding down the Power button until the slide to power option appears, and then hold the Home button until the app closes.

Do you have any other tips or tricks for force quitting Mac apps? Share with us in the comments below!

Источник

Оцените статью