If it is a job requirement to use Mac OS, and the guest worker does not know Mac OS, they are
not qualified for the job. If they can meet the requirements by being trained in Mac OS, a local could also meet the requirements by being trained in javascript and Postgres.
Either the company is being deceptive by making the job requirements much narrower than is reasonable, or in claiming that no local could meet them.
Realistically, there are probably at least 18000 people worldwide (top 0.1% of software pros) who could hear that you want javascript embedded in Postgres, and--without any training from you whatsoever--be able to do that two weeks later, and at least 3500 of them are currently authorized to work in the US for any employer. But the people you can get without a visa will want at least $150k a year to do that for you, because they know they are elite software professionals in the US, whereas the person you import may only expect $90k.
Please note that the requirements you mentioned as an example are experience based requirements, not aptitude based requirement. Many of us on HN, given a sufficient lead time, can meet any aptitude based requirement that a company might care to advertise. But none of us can have 5 years of experience with a specific technology tool in less than 5 years.
The sort of requirements that might non-fraudulently require an H1B worker would include fluency in a natural language other than English, or knowledge of certain areas of computing, such as artificial vision, natural language processing, distributed network architecture, custom hardware interfaces, cryptography, and the like. When you need a cryptographer, you ask for someone with a proven aptitude in cryptography, not someone with 5 years of experience in AES, X.509, and "Bitcoin hacking". Structuring requirements that way is a means to intentionally disqualify everyone but the pre-selected applicant. And it is not limited to gaming the immigration system, either, but as a means to discriminate against protected classes. Someone with 30 years of C experience is undoubtedly an experienced software professional, but requiring five years of experience in Node.js is a great way to weed out that applicant for being too old, rather than being unable to do the job.