Ver mac no linux

How can I identify the macOS version from the command line? [duplicate]

After detecting a GNU/Linux system through running uname , in a GNU/Linux distribution lsb_release -a is a good entry level utility you could use to [try to] find out the GNU/Linux distribution name and particular version 1 . After detecting a Darwin (possibly macOS) system through running uname , there must be a Different (maybe not that much. ) way to Ask the OS version number 1 . Even if it only works on macOS, it’d be useful. This is similar to the /etc/release for other Unix / Linux, but I’d like to specifically target macOS to script a check of the version. In what way(s) is this possible?

lsb are specifically Linux tools as per apple.stackexchange.com/a/368245/237 As macOS is not Linux what are you looking for?

And you need to explain what you need as uname -a being arid is not helpful. Hint theis is macOS and many of us do not know what lsb etc provide.

What does lsb_release -a do (on a Linux system), and what exactly do you want to do with the result on macOS? Some more details on this might help to find suitable alternatives .

4 Answers 4

Here are some other options that you could use.

sysctl kern.version kern.version: Darwin Kernel Version 16.7.0: Sun Jun 2 20:26:31 PDT 2019; root:xnu-3789.73.50~1/RELEASE_X86_64 sysctl kern.ostype kern.ostype: Darwin sysctl kern.osrelease kern.osrelease: 16.7.0 sysctl kern.osrevision kern.osrevision: 199506 

And as an alternative to sw_vers

/usr/libexec/PlistBuddy -c "Print:ProductName" \ -c "Print:ProductVersion" \ -c "Print:ProductBuildVersion" /System/Library/CoreServices/SystemVersion.plist Mac OS X 10.12.6 16G2128 

I don’t know if all of this is imposed by Darwin, the manual page seems like it maybe is a Mac OS X (sic in my manual page as of Sep 2019) thing, but there is the awesome sw_vers :

$ sw_vers ProductName: Mac OS X ProductVersion: 10.14.6 BuildVersion: yadda yadda yadda $ _ 

LSB stands for «Linux Standard Base».

macOS isn’t Linux, so it isn’t part of the LSB project, and doesn’t support LSB tools.

Actually, one of the major reasons for the LSB Specifications is that they provide a precise description of the APIs and ABIs required to run «Linux» applications independent of Linux. IOW, you should not need Linux to run an LSB-conformant Linux application, and you should not need to look at Linux to develop an LSB-conformant OS. For example, HP-UX, IBM AIX, and FreeBSD provide LSB-conformant ABIs and APIs that allow you to run LSB-conformant «Linux» applications unmodified. So, the argument that macOS doesn’t support LSB because it isn’t Linux is invalid, since that’s actually one of …

Читайте также:  All linux man pages

… the purposes of the LSB: to allow Operating Systems that are not Linux to be compliant with the LSB without having to derive from or look at Linux source code.

@JörgWMittag But that assumes that the OS authors want to be compliant and can be bothered to write what they see as unnecessary code.

Use the standard way — uname — defined in POSIX so works in all Unix systems and sopme others that provide compatibility.

Examples from my Mac mini running macOS 10.14.6

Darwin mini12 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64 

Given the question you link to the full answer is possibly alter the script in https://stackoverflow.com/a/56968182/151019 The code for macOS is the same as for Solaris except change the DIST and OS values

uname -v prints the operating system version. (actual POSIX definition is Write the current version level of this release of the operating system implementation.) For macOS it prints the Darwin version. The Linux man page says it prints the kernal version. (Solaris has the same definition as the macOS man page so I assume it is the version of the Solaris kernal.)

Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 

and uname -r just gives the number (POSIX definition — Write the current release level of the operating system implementation.)

Источник

Mac OS X не является дистрибутивом Linux, но …

Обе операционные системы имеют одни и те же корни

Mac OS X, операционная система, используемая на настольных компьютерах и ноутбуках Apple, и Linux основаны на операционной системе Unix, которая была разработана в Bell Labs в 1969 году Деннисом Ритчи и Кеном Томпсоном. Операционная система, используемая на iPhone от Apple, теперь называется iOS , является производной от Mac OS X и, следовательно, также является вариантом Unix.

Как и во всех основных дистрибутивах Linux, таких как Ubuntu, Red Hat и SuSE Linux, в Mac OS X имеется «среда рабочего стола», которая предоставляет графический пользовательский интерфейс для прикладных программ и системных настроек. Эта среда рабочего стола построена поверх операционной системы типа Unix, точно так же, как среда рабочего стола дистрибутивов Linux построена поверх основной ОС Linux. Тем не менее, дистрибутивы Linux обычно предлагают альтернативные окружения рабочего стола, помимо тех, которые установлены по умолчанию. Mac OS X и Microsoft Windows не дают пользователям возможности переключаться между рабочими средами, за исключением незначительных изменений внешнего вида, таких как цветовые схемы и размер шрифта.

Читайте также:  Html editors in linux

Общие корни Linux и OS X

Практический аспект общих корней Linux и Mac OS X заключается в том, что оба они следуют стандарту POSIX. POSIX расшифровывается как интерфейс переносимой операционной системы для Unix-подобных операционных систем . Эта совместимость позволяет компилировать приложения, разработанные в Linux, в системах Mac OS X. Linux даже предоставляет опции для компиляции приложений на Linux для Mac OS X.

Как и дистрибутивы Linux, Mac OS X включает приложение Terminal , которое предоставляет текстовое окно, в котором вы можете запускать команды Linux/Unix. Этот терминал также часто называют командной строкой или shell или оболочкой . Это текстовая среда, которую люди использовали для управления компьютерами до того, как стал доступен графический интерфейс пользователя. Он все еще широко используется для системного администрирования и создания сценариев автоматизированных процессов.

Популярная оболочка Bash доступна в Mac OS X, включая Mountain Lion, как и почти во всех дистрибутивах Linux. Оболочка Bash позволяет быстро перемещаться по файловой системе и запускать текстовые или графические приложения.

В командной строке/оболочке вы можете использовать все основные команды Linux/Unix и оболочки, такие как ls , cd , cat и более . Файловая система структурирована как в Linux, с разделами/каталогами, такими как usr , var , etc , dev и home вверху, хотя в OS X есть несколько дополнительных папок.

Основными языками программирования операционных систем Unix-типа, таких как Linux и Mac OS X, являются C и C ++. Большая часть операционной системы реализована на этих языках, и многие базовые приложения также реализованы на C и C ++. Языки программирования более высокого уровня, такие как Perl и Java, также реализованы в C/C ++.

Apple предоставляет язык программирования Objective C , включая Xcode IDE (интегрированная среда разработки), для поддержки разработки приложений для OS X и iOS.

Как и Linux, OS X включает мощную поддержку Java и фактически обеспечивает настраиваемую установку Java, чтобы обеспечить бесшовную интеграцию приложений Java в OS X. Он также включает в себя терминальные версии текстовых редакторов Emacs и VI, которые популярны в системах Linux. Версии с большей поддержкой графического интерфейса можно загрузить из Apple AppStore.

Читайте также:  Linux проверить исполняемый файл

Основные различия

Одним из различий между Linux и Mac OS X является так называемое ядро. Как видно из названия, ядро ​​является ядром ОС Unix-типа и реализует такие функции, как управление процессами и памятью, а также управление файлами, устройствами и сетью. Когда Линус Торвальдс разработал ядро ​​Linux, он выбрал то, что называется монолитным ядром по соображениям производительности, в отличие от микроядра, которое разработано для большей гибкости. Mac OS X использует дизайн ядра, который компромисс между этими двумя архитектурами.

Хотя Max OS X в основном известен как операционная система для настольных компьютеров/ноутбуков, последние версии OS X также можно использовать в качестве серверной операционной системы, хотя необходимо приобрести дополнительный пакет Server App, чтобы получить доступ ко всем серверам. Приложения. Linux, однако, остается доминирующей серверной операционной системой.

Источник

Is it possible to install Linux packages on OS X?

I know that the Mac commandline is very similar to that of Linux operating systems, so it would be nice to use some features of Linux in my Mac, specially installing Linux packages. For example, in Linux we can install a package by simply typing sudo apt-get install «package name» at the prompt. Is it possible to do something like this on Mac?

3 Answers 3

Yes, it is possible to install and run a variety of UNIX applications on OS X. There are a few solutions out there, my choice and recommendation is Homebrew. I’ve found other solutions to be overly complex and unwieldy.

in linux terminal installing command does any thing automatically it downloads files and . how about Homebrew? is it required to download files manually?

@peaceman once you’ve set up Homebrew, it downloads all the dependencies and files you need for any package you install from its repository. It’s a beautiful thing, really.

@CajunLuke for one MacPorts will install duplicates of everything it needs. Don’t want another bzip2? Too bad, you’re getting one. Brew on the other hand leverages the existing system. I have 23 packages I like to install. With Macports that balloons with dependancies to 144 packages. With Homebrew, only 44. That’s what I call «overly complex». You should seriously try Homebrew. You’ll like it better.

Like I said, you should seriously try it. It’s easier to manage, it’s easier to use, it’s easier to fix and it’s easier to contribute. I’m not trying to win. Just see for yourself, then pick the one you prefer.

Источник

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