Why can’t a macOs be installed in a Windows computer?

Why can’t a macOS be installed in a Windows computer?

Why can’t a macOS be installed in a Windows computer?

macOS, also known as Mac OS X, is a proprietary operating system developed and maintained by Apple Inc. for use on Apple’s Macintosh computers. This operating system is not designed to be installed on non-Apple hardware, such as a Windows computer. This is because macOS is specifically built to work with Apple’s hardware and software ecosystem, and is therefore not compatible with the hardware and software of a Windows computer. Additionally, Apple has put in place technical and legal restrictions to prevent macOS from being installed on non-Apple hardware.

Why can’t a macOS be installed in a Windows computer?
Why can’t a macOS be installed in a Windows computer?

Apple don’t want that to happen.

Not because they want to extract more money from hardware sales (Apple hardware is actually cheap for the quality you get anyway), not because they wouldn’t sell OS X as a product if they could.

It’s really simple: they did the math on the support costs of random third party hardware, and the numbers came up “nope”.


Apple actually did this long before OS X was a thing; for a short while you could actually get a licensed non-Apple MacOS computer.

But the support costs killed it.

To actually do this and make money, they’d have to sell OS X for a couple of thousand dollars, or maybe a subscription at about $50/month. That’s to pay for the three or four thousand developers and ten or so thousand support people they’d have to hire to deal with all the random crap hardware out there.


AI Unraveled: Demystifying Frequently Asked Questions on Artificial Intelligence (OpenAI, ChatGPT, Google Bard, Generative AI, Discriminative AI, xAI, LLMs, GPUs, Machine Learning, NLP, AI Podcast)

And it still wouldn’t meet their quality targets anyway.

So how can Microsoft do it?

They get the OEMs and hardware manufacturers to deal with most of it. Which they mostly do badly, but people have somehow become used to the resulting mess.

If you are looking for an all-in-one solution to help you prepare for the AWS Cloud Practitioner Certification Exam, look no further than this AWS Cloud Practitioner CCP CLF-C02 book

Making the OS itself free does mean that they don’t want people to install it on third party hardware because that would mean zero profits from the extra user (unless they use services such as iCloud in a premium fashion — more than just what’s given free).

I guess that makes the hackintoshing phenomenon an issue. Now, when the support for the last Intel based Mac ends hackintoshing will be a real issue (I mean, some explicitly limit themselves to High Sierra because of some NVidia GPUs that aren’t supported on newer versions at all…). But for now, if you have good, compatible hardware, you can reap the benefits just fine.

I am currently a hackintosher but intend to get an actual MacBook Pro (Intel based) soon. Wouldn’t have happened if I didn’t get a good hackintosh. So I’d say, don’t fight those who try it out like this and then migrate to actual Apple products, since that’s actually a profit vector. Only fight those that do it despite that.

The better question to ask is “How does Linux do it?”. You can find drivers for most of “the random crap hardware out there”… You can “google yourself” the support for most of the issues you’d run into, unlike Windows, etc. Support is a “thing” mostly for corporate users. Companies need someone to sue in case they’d somehow lose a penny because of hw/sw issues.

Using Windows would be much better than hackintoshing. Windows has its issues, it is not as reliable as macOS. However, Windows is much more flexible than macOS. It is much more programmer friendly than macOS. Most of the advantages of macOS will cease to exist once you take it out of the integration with Apple hardware.

You can, not so easily, run the OSX on a windows machine as you would run a second version of windows or Linux or any other OS. My current machine has around 4 different OS in 2 drives. The machine was originally assembled keeping in mind running it on OSX, endearingly known by the community as Hackintoshs. I did run an OSX version of Snow Leopard for a few months but didn’t have much use of it as I already own a MacBook Pro. A fun project but not without hastles.

Also, I did shift my 10+ year old MacBooks drive into the machine, before writing this reply, just for fun. Given the changes over time, the OSX failed to recognise half the peripherals which is solvable, but would need a lot of work.

You can. Such computers are called a “Hackintosh.” The procedure is totally unsupported, but I suppose it can save the user some money, when it works.

It’s not that it can’t. It’s a violation of the end-user license. If you’d like to give a try, just google out Hackintosh. I am not aware of any prosecution if you do. Definitely nothing like the infamous Microsoft initiated BSA raids on companies and individual users.

How to pipe grep on command line on windows and Linux

How to pipe grep on command line on Windows and Linux?

Let’s find how to pipe grep or find a specific string after running a command using shell, batch and powershell (windows and Linux)

  • On Linux via shell

    ls -al | grep filename

  • On Windows via powershell

    GetChildItem | Select-Object “filename”
    or
    GetChildItem | where-Object {$_ -match “filename”}

  • On Windows via batch

    Dir | findstr “filename”

On both Windows and Linux, you can use the grep command in combination with the | (pipe) operator to filter the output of another command. The | operator takes the output of the command on the left and passes it as input to the command on the right.

Here is an example of how to use the grep command with the | operator on both Windows and Linux:

On Linux:

# List all the files in the current directory and filter the output to show only the files that contain the word "example"
ls | grep example

On Windows:


# List all the files in the current directory and filter the output to show only the files that contain the word "example"
dir | findstr example

In this example, the ls (Linux) or dir (Windows) command lists all the files in the current directory, and the grep (Linux) or findstr (Windows) command filters the output to show only the lines that contain the word “example”.

You can use the grep command with the | operator in combination with other command-line utilities to perform various tasks. For example, you can use the grep command to filter the output of the ps command to show only the processes that contain a particular string in their command line arguments.

# Show all the processes that contain the string "python" in their command line arguments
ps -aux | grep python

I hope this helps! Let me know if you have any questions.


AI Unraveled: Demystifying Frequently Asked Questions on Artificial Intelligence (OpenAI, ChatGPT, Google Bard, Generative AI, Discriminative AI, xAI, LLMs, GPUs, Machine Learning, NLP, AI Podcast)

reverse a string on Linux and Windows

How to reverse a string on Linux and Windows

On Linux:

  1. Using the rev command: The rev command is a utility that reverses the lines of a file or the characters in a string. To reverse a string, you can use the echo command to pass the string to rev:
echo "string" | rev
  1. Using the sed command: The sed command is a powerful utility that can perform various text transformations. To reverse a string, you can use the sed command with the -r option and the 's/.*(.)/\1/g' expression:
echo "string" | sed -r 's/.*(.)/\1/g'
  1. Using the awk command: The awk command is a programming language that is used for text processing. To reverse a string, you can use the awk command with the {print} action:
echo "string" | awk '{print $1}'

On Windows:

  1. Using the powershell command: The powershell command is a shell that provides a command-line interface for Windows. To reverse a string, you can use the powershell command with the -C option and the '[System.Text.Encoding]::Unicode.GetString([System.Text.Encoding]::Unicode.GetBytes("string"))' expression:
powershell -C "[System.Text.Encoding]::Unicode.GetString([System.Text.Encoding]::Unicode.GetBytes("string"))"
  1. Using the cmd command: The cmd command is the command-line interpreter for Windows. To reverse a string, you can use the cmd command with the for loop:
cmd /c "for /L %i in (1,1,%len%) do @echo !string:~%len%-%i,1!"

These are some ways to reverse a string on Linux and Windows. There are other ways to achieve this, using different utilities or programming languages.

Via shell script on Linux

reverse a string on Linux and Windows

sh-3.2# vi reverse.sh
#### Start Script #####
#!/bin/bash
input_string=”$1″
reverse_string=””


input_string_length=${#input_string}
for (( i=$input_string_length-1; i>=0; i– ))
do
reverse_string=”$reverse_string${input_string:$i:1}”
done

echo “$reverse_string”
##### End Script #####

Let’s run it:


AI Unraveled: Demystifying Frequently Asked Questions on Artificial Intelligence (OpenAI, ChatGPT, Google Bard, Generative AI, Discriminative AI, xAI, LLMs, GPUs, Machine Learning, NLP, AI Podcast)

sh-3.2# chmod 775 reverse.sh
sh-3.2# ./reverse.sh Etienne
enneitE

Via powershell script on Windows

#Let’s use the script reverse.ps1 below.
######
$string=”Etienne”
$string_array=$string -split “”
[array]::Reverse($string_array)
$string_array -join ”

#####Output#####
PS C:\Users\etienne_noumen\Documents\Etienne\Scripting> .\reverse.ps1

If you are looking for an all-in-one solution to help you prepare for the AWS Cloud Practitioner Certification Exam, look no further than this AWS Cloud Practitioner CCP CLF-C02 book

E t i e n n e

enneitE

Via powershell script on Windows in one line

([regex]::Matches($String,’.’,’RightToLeft’) | ForEach {$_.value}) -join ”

Via batch script on Windows

::Note: ReverseStr also calls StrLen
::and string length is not greater than 80 chars
:: but can be changed.

@echo off
SetLocal EnableDelayedExpansion
cls
set Str=Etienne
call :StrLen %Str%
echo Length=%Len%
call :ReverseStr %Str%
echo String=%Str%
echo Reverse Str=%Reverse%
exit /b

::—————-
:: Calc Var Length
::—————-
:: %*=Str to Check
:: Returns %Len%
:: —————
:StrLen %*
set Data=%*
for /L %%a in (0,1,80) do (
set Char=!Data:~%%a,1!
if not “!Char!”==”” (
set /a Len=%%a+1
) else (exit /b)
)
exit /b

::—————
:: Reverse String
::—————
:: %* Str to Reverse
:: Returns %Reverse%
::——————
:ReverseStr %*
set Data=%*
call :StrLen %Data%
for /L %%a in (!Len!,-1,0) do (
set Char=!Data:~%%a,1!
set Reverse=!Reverse!!Char!
)
exit /b

Via perl script on Windows or Linux

Via python script on Windows or Linux

def reverse_string(a_string)
return a_string[::-1]
reverse_string(“etienne”) returns “enneite”
Source:

  1. http://www.computing.net/answers/programming/reverse-a-string-in-dos/26004.html

Remove all empty lines in a file

How to Remove all empty lines in a file on Linux and Windows?

Remove empty lines from file.txt via Linux command line

  • Option 1: sed -i ‘/^$/d’ file.txt
  • Option 2: awk ‘NF > 0’ file.txt > output.txt
  • Option 3: perl -i.backup -n -e “print if /\S/” file.txt
  • Option 4: grep . file.txt > output.txt

Remove empty lines from file.txt using Powershell script on Windows
  • (gc file.txt) | ? {$_.trim() -ne “” } | set-content file.txt
  • Windows Boot process

    Windows Boot Process

    What is involved in Windows Boot Process:

    The Windows boot process involves several stages, in which the operating system performs various tasks to prepare the system for use.

    1. The BIOS (Basic Input/Output System) runs a power-on self-test (POST) to check the system’s hardware components and to load the bootstrap program.
    2. The bootstrap program, also known as the boot loader, is responsible for loading the operating system kernel and transferring control to it. In Windows, the boot loader is called the bootmgr.
    3. The operating system kernel, which is the core of the operating system, initializes the system and starts the system services.
    4. The system services, such as the device drivers, are loaded and initialized.
    5. The operating system loads the user profile and starts the user interface, such as the desktop or the login screen.
    6. The user can log in and start using the system.

    This is a general overview of the Windows boot process. The exact sequence of events may vary depending on the specific version of Windows and the hardware configuration of the system.

    Windows_Booting_Procedure

      • Power is turned on.
      • The first process starting when you turn on your computer is BIOS i.e, Basic Input Output System. BIOS has two functions, to conduct POST and read MBR.
        1. POST – POST stands for Power On Self Test. POST checks all the hardware devices connected to a computer like RAM, hard disk etc and make sure that the system can run smoothly with those hardware devices. If the POST is a failure the system halts with a beep sound.
        2. Now BIOS checks the boot priority. We can set the boot priority as CD drive, hard disk or floppy drive
        3. MBR – The next duty of BIOS is to read the MBR. MBR stands for Master Boot Record and its the first sector on a hard disk. MBR
          contains the partition table and boot loader.
      • Functions of Boot loader
        Now BIOS has passed the control to boot loader and boot loader is a small program which loads kernel to computers memory. Actually there are two stages of boot loaders, stage 1 boot loader and stage 2 boot loader. MBR contains the stage 1 boot loader and stage 1 boot loader is a link to the stage 2 boot loader. The stage 2 boot loader resides in the boot partition and it loads the kernel to memory.
      • Boot files and functions
        There are three boot files in a Windows operating system and they are NTLDR, NTDETECT.COM and Boot.ini. The boot files are found in the active partition of hard disk and its normally C drive in a Windows machine.

        1. NTLDR – NTLDR stands for NT Loader and its the second stage bootloader. The path of NTLDR is C:\Windows\i386\NTLDR.
        2. Boot.ini – Boot.ini contains the configuration files of NTLDR. When the operating system is loaded we cannot pass any arguments to kernel, so those arguments are passed through boot.ini. You can edit boot.ini by opening through notepad. The path of Boot.ini is C:\boot.ini.
        3. NTDETECT.COM – This file detect hardware’s and passes information to NTLDR. Using the collected information the NTLDR creates a hardware key and this key is used to detect hardware’s. A new hardware key is generated after each reboot of the operating system and that’s why system asks to reboot after installation of a new hardware. The hardware keys created by NTLDR can be found in Windows registry at
          HKEY_LOCAL_MACHINE -> HARDWARES.
      • Kernel and its functions
        After executing the functions of boot files the control is passed to Kernel. ntoskrnal.exe is the kernel file in a Windows machine and its path is C:\Windows\system 32\ntoskrnal.exe. Kernel acts as a layer between software and hardware. The library file hal.dll (C;\Windows\system32\hal.dll) helps Kernel to interact with hardware’s. HAL stands for Hardware Abstraction Layer and this hal.dll file is
        machine specific. Now the drivers for hardware’s are loaded from the file C:\Windows\system32\config\system and the Kernel is loaded to primary memory.
    • Services and log in procedure
      When kernel is loaded in the primary memory services for each process is started and the registry entry for those services can be found at HKEY_LOCAL_MACHINE – System – Current control set – Services.
      Winlogon.exe (C:\Windows\system32\winlogon.exe) is the last service started during this process.
      Winlogon.exe starts the log in procedures of windows machine. It first calls the library file msgina.dll (C:\Windows\system32\msgina.dll). MSGINA stands for Microsoft Graphics Identification and Authentication and it provides the log in window. Now msginal.dll passes the control to LSA (Local Security Authority), it verifies the username and password from the SAM file. SAM (Security Accounts Manager) contains the information about all users created in a Windows operating system.
      Now the booting procedure is over and we have reached the desktop of Windows operating system.

    Source:

    1. Windows Booting Process
    2. Understanding the boot process

    List only regular file names in a directory

    How to List only regular file names in a directory on Linux and Windows

    Listing regular files in a directory without including . and .. files.


    • On Linux

      Solution 1:$ ls -p | grep -v /
      Solution 2: $ ls -F | grep -v ‘[/@=|]’
      Solution 3: $for list in `ls` ; do ls -ld $list | grep -v ^d > /dev/null && echo $list ; done ;
      Solution4:$ for list in `ls` ; do ls -ld $list | grep ^d > /dev/null || echo $list ; done ;
      Solution5 (exclude sym links):$ for list in `ls` ; do ls -ld $list | grep -v ^l > /dev/null && echo $list ; done ;


    • On Windows

      Solution 1: dir /a-d /b >..\File_List.txt

    Set Date and time via command line

    Let’s find out how to set Date and time via command line on linux and windows:

    • On Linux via terminal

      System time (Must have sudo privilege)
      date -s ‘2015-07-28 15:27:30’
      Hardware time
      Let’s set the hardware clock to the current system time:
      hwclock –systohc

    • On Windows via command prompt terminal

      System time (Must have Administrator privilege)
      date
      The current date is: 07/28/2015
      Enter the new date: (mm-dd-yy)_
      time
      The current time is: 15:34:03.44
      Enter the new time: _

    Replace all instances of a string in a file

    How to Replace all instances of a string in a file?

    How to Replace all instances of a string in a file?

    1. Open the file in read mode using the open() function.
    2. Read the contents of the file into a string using the read() method.
    3. Use the replace() method to replace all instances of the target string with the new string.
    4. Open the file in write mode using the open() function.
    5. Write the modified string to the file using the write() method.
    6. Close the file using the close() method.

    Here is an example code snippet:

    How to Replace all instances of a string in a file?
    How to Replace all instances of a string in a file?

    This will replace all instances of old_string with new_string in the file file.txt.

    # Open the file in read mode
    with open(‘file.txt’, ‘r’) as f:
    # Read the contents of the file into a string
    contents = f.read()

    # Replace all instances of the target string
    contents = contents.replace(‘old_string’, ‘new_string’)


    # Open the file in write mode
    with open(‘file.txt’, ‘w’) as f:
    # Write the modified string to the file
    f.write(contents)

    # Close the file
    f.close()

    Shell script to replace all instances of a string in a file on Linux & Windows.

    • On Linux via bash script

      sed “s/$stringToReplace/$replaceWith/g” $File_Name > $File_Name

    • On Windows using Powershell

      ( get-content $File_Name ) | % { $_ -replace $stringToReplace, $replaceWith } | set-content $File_Name

    • On Windows using Batch

      set str=teh cat in teh hat
      echo.%str%
      set str=%str:teh=the%
      echo.%str%

      Script Output:
      teh cat in teh hat
      the cat in the hat

    • On Windows or Linux using Perl

      perl -pi.orig -e “s///g;”

    • On Windows or Linux using Python

    Source:


    AI Unraveled: Demystifying Frequently Asked Questions on Artificial Intelligence (OpenAI, ChatGPT, Google Bard, Generative AI, Discriminative AI, xAI, LLMs, GPUs, Machine Learning, NLP, AI Podcast)
    1. http://stackoverflow.com/questions/60034/how-can-you-find-and-replace-text-in-a-file-using-the-windows-command-line-envir

    Search all files containing a specific string

    How to search all files containing a specific string on Linux and Windows?

    • On Linux

      grep -rnw ‘directory’ -e “pattern”
      grep –include=\*.{txt,log} -rnw ‘directory’ -e “pattern”
      This will only search for files with .txt or .log extension.
      grep –exclude=*.txt -rnw ‘directory’ -e “pattern”
      This will exclude files with .txt extensions.

    • On Windows

      CD Location
      FINDSTR /L /S /I /N /C:”pattern” *.log

    error: Content is protected !!